[algogeeks] Re: Amazon - Interview Qn

2011-08-31 Thread Abhinav Vishwa
Recursion can be used as a approach. void disp( node * head, int i) { i++; if(i n || head == NULL) return; disp(head-next,i); if(head != NULL) cout head-data endl; } first call this function with pointer to head and 0; disp(first,0); then

Re: [algogeeks] Re: Amazon - Interview Qn

2011-08-31 Thread veera reddy
http://geeksforgeeks.org/archives/8014 On Wed, Aug 31, 2011 at 3:28 PM, Abhinav Vishwa avishw...@gmail.com wrote: Recursion can be used as a approach. void disp( node * head, int i) { i++; if(i n || head == NULL) return; disp(head-next,i); if(head != NULL)