Midterm Study From Quizes Flashcards
Arrange the following expressions from the slowest to fastest growth rate.
false
O(n). When resizing, a new array must be created, and each existing element in the old array is then individually copied into the new array.
When do we need to increase the capacity of the underlying data storage array (i.e. data) in order to make space for the new element.
When the array is full, the current size equals the capacity. We must then call resize() to increase the array capacity
[0, 3, 6, 9, 12, 15]
The order in which elements are placed into the Bag ADT is important
False, Conceptually, we use the Bag ADT when the insertion order is irrelevant for the problem we’re working on.
Which of the following provides better speed for a dynamic array?
Suppose the size of the dynamic array is n, and we want to insert an element into the array. What is the maximum number of elements we have to move.
n,
What will happen if we attempt to remove a value from an empty queue
It will raise an exception when the operation is attempted on an empty queue