+ 4

How the recursion is happening ? I want to know that which method is being called in what sequence??

https://code.sololearn.com/cJivO4pSap2p/?ref=app

5th May 2020, 5:56 PM
Abhay Kalsi
Abhay Kalsi - avatar
2 Respuestas
+ 1
run it with this import java.util.Stack; ... public void goo(int input[]) { this.length = input.length; foo(0, 6, "."); // . dot } Stack<String> st = new Stack<>(); int i; public void foo(int low, int high, String a) { st.push(low +","+ high +" "+ a +i++); // System.out.println(st); // int mid = (low + high) / 2; if (low < high) { foo(low, mid, "L"); // L foo(mid + 1, high, "R"); // R } st.pop(); i--; // } } //end of class
5th May 2020, 11:52 PM
zemiak
+ 2
Thanks buddy 😃
6th May 2020, 3:51 AM
Abhay Kalsi
Abhay Kalsi - avatar