ps(2):
Current output ""
n != 0 so else: print [ output = "["
call ps(1)
ps(1):
Current output "["
n != 0 so else: print [ output = "[["
call ps(0)
ps(0):
Current output "[["
n == 0: print "*" output = "[[*"
return
ps (1): after first call
output = "[[*"
print "," output = "[[*,"
call ps(0):
ps(0):
current output "[[*,"
n == 0: print "*" output = "[[*,*"
return
ps(1): after second call
output = "[[*,*"
print "]" output = "[[*,*]"
return
ps(2): after first call
output = "[[*,*]"
print , output = "[[*,*],"
call ps(1)
ps(1):
Current output [[*,*],
n != 0 so else: print [ output = "[[*,*],["
call ps(0)
ps(0):
Current output "[[*,*],["
n == 0: print "*" output = "[[*,*],[*"
return
ps (1): after first call
output = "[[*,*],[*"
print "," output = "[[*,*],[*,"
call ps(0):
ps(0):
current output "[[*,*],[*,"
n == 0: print "*" output = "[[*,*],[*,*"
return
ps(1): after second call
output = "[[*,*],[*,*"
print "]" output = "[[*,*],[*,*]"
return
ps(2): after second call
output = "[[*,*],[*,*]"
print "]" output = "[[*,*],[*,*]]"
return
Final output: "[[*,*],[*,*]]"