Please answer the following multiple choice questions and provide a written expl
ID: 3878899 • Letter: P
Question
Please answer the following multiple choice questions and provide a written explanation for each answer.
39. The drawbacks of the array-based implementation of queues stem from a. the fact that arrays are of fixed size b. the complex logic required to implement floating front and rear c. the need to shift array elements before the enqueue operation. d. the lengthy code recuired to implement the queue operations. e. the need to shift array elements after the dequeue operation f. the fact that the array-based queue operations cost (n) g. none of the above 40. searching a sorted array, the search algorithm with the simplest logic is a. binary search. b. hashing. c. sequential search. d. dictionary search. e. self-organizing list. f. replacement selection g. none of the aboveExplanation / Answer
39. e) the need to shift array elements after the dequeue operation.
Exp : After we insert each and every element at rear, we need to shift every element to its next slot so that we can free rear position for next element to insert.
40. a) binary search.
Exp : Binary search works with O(log N) in sorted array by ignoring half of the array in each search by picking and searching with mid element.