Question: DATA STRUCTURE & ALGORITHMS QUESTION 2 1. Given the initial contents of an array implementation of a stack: 0 1 2 3 4 5 Stack
DATA STRUCTURE & ALGORITHMS
QUESTION 2

1. Given the initial contents of an array implementation of a stack: 0 1 2 3 4 5 Stack 10 50 12 Top Show the final contents of the stack and the location of Top after execute following statements: [7 Marks] stack.pop(); stack.push(14); stack.push(81); stack.push(99); stack.push(22); stack.push(30); stack.pop(); stack.push(11); BCS1093 Page 2 of 4 MODEL EXAM 2. Given the initial contents of a circular array implementation of a queue: 0 1 2 3 4 5 Queue 14 50 24 F R Show the final contents of the stack and the location of F and R after execute following statements: queue. de queue (); queue.enqueue (17); queue.enqueue (38); queue.enqueue (91); queue. de queue (); queue.enqueue (12); queue.enqueue (21); 0 1 2 3 4 5 Queue 12 21 24 17 38 91 F R
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
