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 4 0 C
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
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 4 0 C
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 4 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. lengueuelarg[0]); Dengueue (arr[1]); qenqueue (arr[2]); Tienqueue (arr.[3]); q b. Tadegueue(); q: dequeue(); 9 c. Lingueue (arn[4]); q: enqueue (arm[5]); q d. What is the output of the following statements? System.out.println(q:size()); System.out.println(bifirst()); e. Explain what will happen after executing the following statement. quenqueue (arr[6]); q f. What is the performance (in Big-O notation) of each of the previous methods? Explain.