Refill Stack using Node Implementation

后端 未结 2 708
灰色年华
灰色年华 2021-01-26 18:17

I\'m having a hard time refilling the stack after i take it all off in order to print it out. I am using node implementation so i think this fact is what is confusing me. Any su

2条回答
  •  太阳男子
    2021-01-26 18:59

    If you want to print the contents of a stack and then push all the values back in the same order, I would suggest pushing the values onto a different stack after printing them. Then once the original stack is empty, pop all of the values from the second stack back into the original stack.

提交回复
热议问题