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 lecture.
Answers
Answered by
21
hey here is your answer
Explanation:
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.
Answered by
2
Answer:
minimum: 1, maximum: 32
Explanation:
No need to explain this ....
Similar questions