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.

Create a free account to access the full course.

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