Question: Question (d) ONLY please 3. (a) Given an empty stack, execute the following sequence of operations: push(7), push(8), push(9), pop0, pop0,push(3), pop), push(5). What is
Question (d) ONLY please

3. (a) Given an empty stack, execute the following sequence of operations: push(7), push(8), push(9), pop0, pop0,push(3), pop), push(5). What is the content of the stack after these operations have been peformed? In your answer you should give the elements remaining in the stack in order, starting from the top of the stack. Given an empty queue, execute the following sequence of operations: enqueue(7), enqueue(8), enqueue(9), dequeue(), dequeue(), enqueue(3), enqueue(5) What is the content of the queue after these operations have been performed? In your answer you should give the elements remaining in the starting from the front of the queue (2 marks) (b) (2 marks) (c) Write pseudocode for an O(m) algorithm to insert a new element a into a (10 marks) (d) Write an O(n) procedure for merging two sorted arrays into a single sorted (6 marks) non-empty sorted linked list L so that L remains sorted after the insertion of x. array. Describe in detail the run of this procedure on arrays A (1,3,5,7,7) and B (2,4,6,6,8)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
