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
最終的な出力:"[[*,*],[*,*]]"
よくやっていると思いますが、それは何ですか?それから始めよう。 – twain249
あなたのメソッドの@Jason署名は、 'Public void ps(int n)'ではなく 'public void ps(int number)'のようになります。 –
申し訳ありませんが、タイプoがプログラムにないと入力しました – Jason