Quiz 4 (02/24 – 03/02) KEYCSC 172, Data Structures and AlgorithmsSpring 2019Time: 15 minutesStudent’s Name _____________________________________________1. (2 points) State if the following statement are true or false (T/F):a. dequeue() for array-based queue implementation requires time Θ(log n) F b. operation length() for array-based stack implementation requires time Θ(n) F c. all operations for linked queue implementation require constant time T d. operation pop() for linked stack implementation requires time Θ(n) F 2. (4.5 points) Using the list ADT and the operators defined in the lecture, complete the methodbelow that swaps the current element with the one following it.Example: if the list is < 2, 23 15, 5, 9 >, you should get < 2, 23 5, 15, 9 >Note: You can use only the operators we defined for ADT List.private static <E> void switchEl(AList<E> al){ // note: remember AList implements ListE temp; temp = al.remove(); al.next(); al.insert(temp);} // end of the method3. (3.5 points) Consider the stack S below (left). Fill in the values and draw the top pointer in the stack S on the right after performing the sequence of operations below: S4268Sequence of operations:S.pop()S.push(77)S.length()S.push(32)S.topValue()S.pop()S.push(111) S11177268Note: The semantics of the operators is as defined in the ADT Stack discussed in the lecture. You can add more cells in the stack if needed.top
View Full Document