@all:

In my code isntead of (!IsEmptyStack) use IsEmptyStack

Logic :

First pop the all element and then start putting element at bottom in
reverse order i.e. the element which is fetched last is put at the bottom
and so on.

ex: let our stack is: 1 2 3 4 (1 is at bottom).

function Call is will be:

Reverse(S)             -->Reverse(S)              -->Reverse(S)
-->Reverse(S)              -->stack empty so return
InsertAtBottom(4)       InsertAtBottom(3)        InsertAtBottom(2)
InsertAtBottom(1)

going back First 1 will be placed at bottom: stack content :1
now 2 will be placed at bottom: stack content will be: 2 1
now 3 will be placed at bottom: stack content will be: 3 2 1
now 4 will be placed at bottom: stack content will be:4 3 2 1





On Thu, Jun 14, 2012 at 2:46 PM, Nishant Pandey <
nishant.bits.me...@gmail.com> wrote:

> stack means inbuild stack we cant use any DS from our program explicitly.
>
> On Thu, Jun 14, 2012 at 2:44 PM, rahul patil <
> rahul.deshmukhpa...@gmail.com> wrote:
>
>> to store items in stack you will need some DS. Do they mean you cant use
>> any auxillary DS than stack ?
>>
>>
>> On Thu, Jun 14, 2012 at 2:24 PM, Ashish Goel <ashg...@gmail.com> wrote:
>>
>>>
>>> Best Regards
>>> Ashish Goel
>>> "Think positive and find fuel in failure"
>>> +919985813081
>>> +919966006652
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> Regards,
>> Rahul Patil
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Cheers,
>
> Nishant Pandey |Specialist Tools Development  |  
> npan...@google.com<gvib...@google.com> |
> +91-9911258345
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to