...

/

Analysis of RootishArrayStack

Analysis of RootishArrayStack

Explore the advantage of using RootishArrayStack.

Growing and shrinking

Note that, unlike the ArrayStack.resize() operation, grow() and shrink() do not copy any data. They only allocate or free an array of size rr. In some environments, this takes only constant time, while in others, it may require time proportional to rr.

Press + to interact

We note that, immediately after a call to grow() or shrink(), the situation is clear. The final block is completely empty, and all other blocks are completely full. Another call to grow() or shrink() will not happen until at least ...

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy