In Binary Search, the best case occurs when: - answer The item is located in the middle
of the collection.
For linear or sequential search, the average case time performance is: - answer O(n)
In Binary Search, the worst case occurs when: (select all that apply) - answer The item
is not in the collection.
The item is located at the very beginning of the collection.
The item is located at the end of the collection.
Which of the following statements about QuickSort and Mergesort are true?
A. Mergesort is not an example of the divide and conquer algorithm design strategy
because it only does Θ(1) work to divide the problem into two subproblems.
B. Quicksort has a better space-complexity than mergesort because partition() has
space-complexity of Θ(1) while merge() has space-complexity of Θ(n).
C. Both sorts can be made into hybrid sorts by using a non-recursive sort like insertion
sort to process subproblems smaller than a certain size. - answerB and C are true
Which of the following is NOT true about using the compareTo() method in Java to sort
things? - answerYou could rewrite the body of your compareTo() method in order to sort
a list in descending order instead of ascending order.
Assume values is an array of integers that is currently filled to capacity, with the
following values:
9 4 12 2 6 8 18
Which of the following lists of numbers would accurately show the array after the fourth
pass of Insertion sort? - answer2, 4, 6, 9, 12, 8, 18
A vector contains the numbers <7, 2, 9, 5, 4, 1> and Insertion Sort is run on this list.
Which of the following list orderings will never occur during any step of the sorting
process? We are only concerned with the state of the list at the beginning of each
iteration of the outer loop (after each element is fully "inserted"). - answer2, 7, 9, 4, 5, 1
Assume values is an array of integers that is currently filled to capacity, with the
following values:
9 4 12 2 6 8 18
Which of the following lists of numbers would accurately show the array after the fourth
pass of Selection sort? - answer2, 4, 6, 8, 12, 9, 18
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 Dreamer252. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $11.49. You're not tied to anything after your purchase.