Use this ID please **** 202010540 ****
Posted: Fri May 20, 2022 10:42 am
Use this ID please **** 202010540 ****
Question 5 (1 x 12 = 12 marks) Consider your ID as an array of 9 elements. Example ID: 201710340 arr 2 0 1 7 1 0 3 0 Consider a Linear 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.engueuelarr[1]); 9:enqueuelarr[2]); Sengueuelarc [3]); b. sdegueue(); 9.dequeue(); c. quenqueue (arr[4]); 9:enqueuelarr[5]); d. What is the output of the following statements? System.out.printlolasize(); System.out.println(a.first(); e. Explain what will happen after executing the following statement. 9.enqueue Carr[6]); f. What is the performance (in Big-O notation) of each of the previous methods? Explain.
Question 5 (1 x 12 = 12 marks) Consider your ID as an array of 9 elements. Example ID: 201710340 arr 2 0 1 7 1 0 3 0 Consider a Linear 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.engueuelarr[1]); 9:enqueuelarr[2]); Sengueuelarc [3]); b. sdegueue(); 9.dequeue(); c. quenqueue (arr[4]); 9:enqueuelarr[5]); d. What is the output of the following statements? System.out.printlolasize(); System.out.println(a.first(); e. Explain what will happen after executing the following statement. 9.enqueue Carr[6]); f. What is the performance (in Big-O notation) of each of the previous methods? Explain.