Question: Need Help with All Match each operation to their correct runtime efficiency. Question 2 (2 points) Saved For any of the array-based data structures we





Need Help with All
Match each operation to their correct runtime efficiency. Question 2 (2 points) Saved For any of the array-based data structures we have discussed, the resize () method begins its execution by creating a new backing array with capacity determined by max(1,2n) where n is the number of elements currently in the array. Why? To ensure that the new array always has at least capacity for one element. To ensure that the new array always has double the capacity of the current array. To ensure the new array is always as large as possible. resize () does not create a new array. The following questions all ask about operations performed on an array-list with a backing array, a, in the current state: a Question 3 (1 point) Suppose the backing array, a, of an ArrayList is in the following state: a n=6j=1len(a)=8 What is the index of G relative to the backing array, after the call add (6,G) is made? A. Question 4 (1 point) Suppose the backing array, a, of an ArrayList is in the following state: a: n=6j=1len(a)=8 What is the index of F relative to the backing array, after the series of calls below are made? add(6,G) add(5,f) A) Suppose the backing array, a, of an ArrayList is in the following state: a 1=6=1n(a)=8 What is the value of j, after the series of calls below are made? add(6,G)add(5,f)add(2,c) Question 6 (1 point) Suppose the backing array, a, of an ArrayList is in the following state: a: n=6j=1len(a)=8 Which element is located at index 6 , of the backing array after the following series of calls are made? add(6,G)add(5,f)add(2,c)remove(6) Suppose the backing array, a, of an ArrayList is in the following state: a: n=6j=1len(a)=8 What is the final state of the backing array after the following series of method calls? add(6,G) add (5,f) add (2,c) remove ( 6 ) Enter your answer as a list of elements, each element separated by a comma and space. If a a slot in the array is empty, write EMPTY. For example, if your answer were to be the backing array pictured in the diagram, you would need to enter [EMPTY,A,B,C,D,E,F,EMPTY] A) The following questions all ask about operations performed on an ArrayStack with a backing array, a, in the current state: a Question 8 (1 point) Suppose the backing array, a, of an ArrayStack is in the following state: a: What is the index of the element D after the following series of method calls? remove (2) remove (3) remove (0) A/ Suppose the backing array, a, of an ArrayStack is in the following state: a : What is the length of the backing array after the following series of method calls? remove (2) remove (3) remove (0) A Question 10 (1 point) Suppose the backing array, a, of an ArrayStack is in the following state: a What is the length of the backing array after the following series of method calls? remove (2) remove (3) remove (0) remove (1)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
