Computer Science, asked by jjyothika25, 10 months ago

Let's imagine we add support to our dynamic array for a new operation PopBack (which removes the last element), and that PopBack never reallocates the associated dynamically-allocated array. Calling PopBack on an empty dynamic array is an error. If we have a sequence of 48 operations on an empty dynamic array: 24 PushBack and 24 PopBack (not necessarily in that order), we clearly end with a size of 0. What are the minimum and maximum possible final capacities given such a sequence of 48 operations on an empty dynamic array? Assume that PushBack doubles the capacity, if necessary, as in lectur

Answers

Answered by frozenPearl93
0

Let's imagine we add support to our dynamic array for a new operation popback ( removes the last element), and that popback never reallocates the associated dynamically-allocated array. calling popback on an empty dynamic array is an error. if we have a sequence of 48 operations on an empty dynamic array: 24 pushback and 24 popback (not necessarily in that order), we clearly end with a size of 0. what are the minimum and maximum possible final capacities given such a sequence of 48 operations on an empty dynamic array? assume that pushback doubles the capacity, if necessary, as in lecture.

Similar questions