CSE 205 Exam 3
Assume you are using a doubly-linked list data structure with many nodes. What is the minimum number of node references that are required to be modified to remove a node from the middle of the list? Consider the neighboring nodes.
2
Given an ordered array with 15 elements. how many elements must be visited in the worst case of binary search?
4
You need to access values in the opposite order in which they are added (last in, first out), and not randomly. Which collection type should you use?
Stack
Assume we are using quicksort to sort an array in ascending order. What can we conclude about the elements to the left of the currently placed pivot element?
They are all less than or equal to the pivot element
Suppose you wish to implement the Comparable interface to allow your Vehicle class to compare Auto objects only. Which of the following is the correct way to do this?
public class Vehicle implements Comparable<Auto>
A queue is a collection that _____.
remembers the order of elements and allows elements to be inserted only at the one end and removed only at the other end
In each iteration, selection sort places which element in the correct location?
the smallest element not yet placed in prior iterations
Choose the order of the following growth rates, from slowest to fastest: theta(n^3), theta(nlog(n)), theta(n^3/2), theta(2^n)
theta(nlog(n)), theta(n^3/2), theta(n^3), theta(2^n)