2 ms·
I need to limit the size of the stack and I want to remove the bottom-most element of the stack before pushing the new element to the top-most position of the s
by kevinhack 11y ago
I need to limit the size of the stack and I want to remove the bottom-most element of the stack before pushing the new element to the top-most position of the stack if the stack has reached the max size.
I think if I use the traditional array, it will be very slow because you need to spend a lot of time on moving, so I finally decide to write my own stack implementation using linked-list.