So when we are at line no.19 then in previous recursion i have read and understood that it will stop it from going further till the call stack is free. so how different combinations can be seen in the output. simply(how after line 19 immediately line 23 would be operated).
THe process in which events happen
@pranjuldwivedi120568 we are just doing like subsequences (in it we either include or exclude and in this is question we either do ( or ) but there is condition too for both of them.)
whats your doubt in this?
my doubt ias that in recursion once we reach recursive call line then it repeats itself but in this problem we get outputs like()() which show after first recursive call it doesn’t reach the first statement but the code proceeds in the next direction as i think after line number 19 the code should repeat itself from line 1 but it in this case compiler goes not at line 1 but towards line 23
@pranjuldwivedi120568 when 19 is called it will keeps on doing until open==n when open==n it will skip 19 and go to 23 and keep calling it . so after 19 always recursion starts from top but acc to if condition it chooses what to call 19 or 23
But if it starts from top after calling line 19 then how would i get output as ( ) ( ) ( )
@pranjuldwivedi120568 if n=2
output will be like
(())
()()
second one will come due to recursion (see the diagram sir made)
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.