Let's imagine we add support to our dynamic array for a new operation PopBack (which removes the last element). PopBack will reallocate the dynamically-allocated array if the size is \leq≤ the capacity / 2 to a new array of half the capacity. So, for example, if, before a PopBack the size were 5 and the capacity were 8, then after the PopBack, the size would be 4 and the capacity would be 4.
Give an example of nn operations starting from an empty array that require O(n^2)O(n
2
) copies.
Answers
Answered by
0
PopBack will reallocate the dynamically-allocated array if the size is \leq≤ the capacity / 2 to a new array of half the capacity. So, for example, if, before a PopBack the size were 5 and the capacity were 8, then after the PopBack, the size would be 4 and the capacity would be 4.
Mark as Brainliest !!
Similar questions