[algogeeks] Re: Algo for in-place Stack Reversal.

2011-10-07 Thread sravanreddy001
yeah... i think its not possible without manipulating the pointers and then use general retrieval logic. reversal retrieval cannot be done without extra space, and without modifying the DS. (like I mentioned before, changing the stack to point to top & manipulating the push, pop functions.) Oth

[algogeeks] Re: Algo for in-place Stack Reversal.

2011-10-07 Thread .itoa
If initially we have : 4 3 2 1 then we need this : 1 2 3 4 We need to do in-place. Even if we can do with loops then how. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussion on the web visit https://groups.google.com/d/m

[algogeeks] Re: Algo for in-place Stack Reversal.

2011-10-07 Thread sravanreddy001
I'm not sure if I got the question correct. How about change the address of stack to point to top and then modify the push,pop functions to retrieve values as push(int a){ stack[--top] = a; } int pop(){ return (stack[a++]); } I know there is serious limitation of not able to add elemen