I need to be able to maintain a stack which varies in length according to circumstances. I want to use shift() and unshift() at the left, and push() and pop() at the right.
I have noticed strange behaviour when using shift(). My simple example below shows the problem.
In this example, when I...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.