a) Consider the following code(assume that pop() returns the Object stored in the stack):
Queue<Integer> q = new LinkedQueue<Integer>();
Stack<Integer> s = new LinkedStack<Integer>();
s.push(1);
s.push(8);
s.push(7);
while (!s.isEmpty()) {
q.enqueue(s.pop());
}
System.out.print(q.dequeue() + ", " + q.dequeue()); // note: a comma and a space character separate the values.
What is the output that is printed when this code executes? (enter exactly what is printed).
b) Consider the following array: 9, 2, 3, 8, 0
We apply selection sort to sort this array in ascending order.
What is the state of the array after the first two rounds of the outer loop?