When shrinking cancels the benefit of growth

A dynamic array doubles its capacity immediately before appending to a full block. After each deletion, if its new size equals half its current capacity, it halves that capacity. Each resize copies every remaining element, and capacity never falls below 8.


Initially its capacity, the number of allocated slots, is CC, where CC is a power of two and C≥32C\geq32. Its size is C/2+1C/2+1. A program repeatedly deletes the last element and then appends one element. Count existing-element copies only. Which statements about each delete-and-append pair are true? Select all that apply.

Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Dynamic Arrays Questions: