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?
A. they are all less than or equal to the pivot element
B. they are all greater than or equal to the pivot element
C. they are all sorted
D. none can equal the pivot element - ANSWERS-A. they are all less than or equal
to the pivot element
Given an ordered array with 15 elements, how many elements must be visited in
the worst case of binary search?
A. 2
B. 8
C. 4
D. 3 - ANSWERS-C. 4
Suppose you wish to implement the Comparable interface to allow you Vehicle
class to compare Auto objects only. Which of the following is the correct way to
do this?
A. public class Auto implements Comparable<Vehicle>
B. public class Vehicle implements Comparable(Auto)
C. public class Vehicle implements Comparable
, D. public class Vehicle implements Comparable<Auto> - ANSWERS-D. public class
Vehicle implements Comparable<Auto>
A queue is a collection that _________________.
A. remembers the order of elements, and allows elements to be added and
removed only at one end
B. remembers the order to elements and allows elements to be inserted only at
one end and removed only at the other end
C. does not remember the order of elements, but allows elements to be added in
any position
D. remembers the order of elements and allows elements to be inserted in any
position - ANSWERS-B. remembers the order of elements and allows elements to
be inserted only at one end and removed only at the other end
Assume you are using a doubly-linked list data structure with many notes. What is
the minimum number of node references that are required to be modified to
remover a node from the middle of the list? Consider the neighboring nodes
A. 3
B. 2
C. 4
D. 1 - ANSWERS-B. 2
You need to access values in the opposite order in which they were added (last in,
first out) and not randomly. Which collection type should you use?
A. hashtable
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller Teacher101. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $17.99. You're not tied to anything after your purchase.