Advertisement
Arbitrator

Untitled

Jan 9th, 2020
11,410
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. Dynamic shrinking. With the array implementations of stack and queue, we doubled the size of the array when it wasn’t big enough to store the next element. If we perform a number of doubling operations, and then delete a lot of elements, we might end up with an array that is much bigger than necessary. Implement the following strategy: whenever the array is 1/4 full or less, shrink it to half the size. Explain why we don’t shrink it to half the size when it is 1/2 full or less.
  2. Stacks at PU
  3. https://algs4.cs.princeton.edu/13stacks/
  4. Stacks
  5. http://algorithms.mrseliasclasses.org/2-stacks-problems/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement