Question: 201810302 arr 0 Question 2 (1 x 13 = 13 marks) Consider your ID as an array of 9 elements. Example ID: 201710340 2 0

201810302 201810302 arr 0 Question 2 (1 x 13 = 13 marks) Consider

arr 0 Question 2 (1 x 13 = 13 marks) Consider your ID as an array of 9 elements. Example ID: 201710340 2 0 0 1 Consider a Circular Queue implemented using an array of length 6. Show the contents of the queue after executing each of the following segments of code in order. a) q.enqueue (arr[0]); 9.enqueue (arr[1]); q.enqueue (arr[2]); q.enqueue (arr [3]); b) q.dequeue(); 4.dequeue(); c) q.enqueue (arr[4]); 4. enqueue(arr[5]); 9.enqueue (arr [6]); 9 d) What is the output of the following statements? System.out.println(q.size()); System.out.println(q.first()); e) Explain what will happen after after executing the following statements. q.enqueue (arr[7]); q. enqueue (arr[8]); f) What is the performance (in Big-O notation) of each of the previous methods? Explain

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!