Chapter 24 Implementing Lists, Stacks, Queues, and Priority Queues
Section 24.2 Common Operations for Lists
1. is a data structure to store data in sequential order.
a. A list
b. A set
c. A tree
d. A stack
e. A queue
#
2. Which of the following operations are supported by a list?
a. Retrieve an element from this list.
b. Insert a new element to this list.
c. Delete an element from this list.
d. Find how many elements are in this list.
e. Find whether an element is in this list.
#
3. Which of the following statements are true?
a. MyArrayList and MyLinkedList are two concrete implementations of MyList.
b. MyArrayList is implemented using an array. The array is dynamically created. If the capacity of the array is
exceeded, create a new larger array and copy all the elements from the current array to the new array.
c. MyLinkedList is implemented using a linked structure.
d. A linked structure consists of nodes. Each node is dynamically created to hold an element. All the nodes are linked
together to form a list.
#
Section 24.3 Array Lists
4. In the implementation of MyArrayList, which of the following are true?
a. size indicates the number of elements in the list.
b. capacity is the length of the array used to store the elements in the list.
c. capacity is always greater than size.
d. size is reduced by 1 if an element is deleted from the list.
e. capacity is reduced by 1 if an element is deleted from the list.
#
5. In the implementation of MyArrayList, which of the following are true?
a. size never reduces.
b. capacity never reduces.
c. Inside MyArrayList, a regular array is used to store elements.
d. size is not declared in MyArrayList, but declared in MyAbstractList as protected.
e. If the current capacity equals to size, capacity is doubled when a new element is added to MyArrayList
#
Section 24.4.3 Implementing MyLinkedLinked Lists
6. In the implementation of MyLinkedList, which of the following are true?
a. MyLinkedList contains all the methods defined in MyList. Additionally, MyLinkedList defines several new methods