I am trying to understand the following Algorithm. It is a recursive algorithm but i am confused whether the two for loops are nested?
or first i will run 3n times then condition for n>1 will be checked.
This is pseudocode form, not exactly in C.
As far as I understand it, if n is 3, i will go from 1 to 9, then condition for n will be checked, since 3>1, PrintAs will be called recursively 4 times.Code:PrintAs (n : integer) for i ← 1 to 3n do print(“A”) if n>1then: forj←1to4 doPrintAs[floor(n/3)]
Please correct me if i am wrong.
thanks