Question: QUESTION 1 The Insert algorithm of Sorted Array Structure has the following steps, put the following steps in correct order (page 76) Step A: Using
QUESTION 1
The Insert algorithm of Sorted Array Structure has the following steps, put the following steps in correct order (page 76)
Step A: Using Binary Search Algorithm to search until finding two adjacent keys that backed the new nodes key
Step B: Move all the nodes below these two nodes and the larger of the two braked nodes down one element to open up a spot for the new node
Step C: The content of the node that we want to insert is deep copied to the spot for the new created node then a reference to that node is placed in the array element that has been opened up
| a. | ABC | |
| b. | BAC | |
| c. | BCA | |
| d. | CBA | |
|
|
|
|
QUESTION 2
The Delete algorithm of Unsorted-Optimized Array Structure has the following steps, put them in correct order (page 67 and 81)
Step A: Move the last node reference into the deleted nodes position.
Step B:Use sequential search to locate the node to be deleted, the search begins at element zero and terminates when the node with the given key is located.
| A. | AB | |
| B. | AB and need another step | |
| C. | BA | |
| D. | BA and need another step |
QUESTION 3
Which one is not correct for the speeds of Unsorted-Optimized Array Structure operations?
| A. | Insert: O(3) | |
| B. | Delete: O(<=n) | |
| C. | Fetch: O(log2n) | |
| D. | Update: O(<= n + 3) | |
|
|
|
|
QUESTION 4
The Insert algorithm of Unsorted Array Structure has the following steps, put the following steps in correct order (page 66)
Step A: index next is incremented by one to prepare for the next insert Step B: A new node object is allocated with its contents initialized to the contents of the node to be inserted Step C: A reference to it is placed into the array at data[next]
| A. | ABC | |
| B. | BAC | |
| C. | BCA | |
| D. | CBA |
QUESTION 5
Which one is not correct for the speeds of Unsorted Array Structure operations
| A. | Insert: O(3) | |
| B. | Delete: O(log2n) | |
| C. | Fetch: O(n) | |
| D. | Update: O(2n + 3) |
QUESTION 6
Which one is correct operation list of ArrayList (page119)?
| A. | Insert, Update, Fetch, Remove | |
| B. | Add, Update, Fetch, Remove | |
| C. | add, get, remove and set | |
| D. | dd, get, delete and set |
QUESTION 7
Which one is the programmer-defined array structure? (page 66)
| A. | The Unsorted array | |
| B. | The Sorted array | |
| C. | The Unsorted-Optimized Array | |
| D. | All of above |
QUESTION 8
Which one is not correct for the speeds of Sorted Array Structure operations
| A. | Insert: O(3) | |
| B. | Delete: O(n) | |
| C. | Fetch: O(log2n) | |
| D. | Update: O(2n ) |
QUESTION 9
For convenience of typing, the Java code replaces the subscript with the index for an array n elements. which one is NOT correct about it (page 63)
| A. | x[i] reference for the element at the index i | |
| B. | index i start by 0 | |
| C. | index i ends by n | |
| D. | the last element in array x is x[n-1] |
QUESTION 10
Fetch algorithm of Unsorted Array Structure with the key targetKey has the following steps, put them in correct order (page 69-70)
Step A: return a deep copy of it
Step B: Use Sequential Search Algorithm starting at element 0 and down the ar ray until an object with the given key is found (page 71)
| A. | AB | |
| B. | AB and need one more step | |
| C. | BA | |
| D. | BA and need one more step |
QUESTION 11
Update algorithm of Unsorted Array Structure with the key field as targeKey will combine two following operation in this order (page 71)
| A. | Fetch - Insert | |
| B. | Insert - Fetch | |
| C. | Insert - Delete | |
| D. | Delete - Insert |
QUESTION 12
The Delete algorithm of Sorted Array Structure has the following steps, put them in correct order (page 74)
Step A: next = next-1 and assign data[next] to null (reclaim unused storage)
Step B:Use Binary Search algorithm to locate the node i to be deleted
Step C: Move all the references below node i to node next-2 up one index
| A. | BAC | |
| B. | BCA | |
| C. | ABC | |
| D. | CBA |
QUESTION 13
Fetch algorithm of Sorted Array Structure with the key targetKey has the following steps, put them in correct order (page 69-70)
Step A: return a deep copy of it
Step B: Use Binary Search algorithm starting to locate the node
| A. | AB | |
| B. | AB and need one more step | |
| C. | BA | |
| D. | BA and need one more step |
QUESTION 14
The Delete algorithm of Unsorted Array Structure has the following steps, put them in correct order (page 67)
Step A: Set the array element that stores the reference to the node to null
Step B:Use sequential search to locate the node to be deleted, the search begins at element zero and terminates when the node with the given key is located.
Step C: Move all the node references below the deleted node up one element in the array and then decrement the memory cell next
| A. | BAC | |
| B. | BCA | |
| C. | ABC | |
| D. | CBA |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
