CSC 345 Section 8.11

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

On average, how many comparisons does Quicksort require to sort 1000 records (to the nearest 1000 comparisons)?

10000

In which cases are the time complexities the same for Quicksort? Worst and Best only Worst, Average, and Best Best and Average only Worst and Average only

Best and Average only

When is Quicksort a good choice for sorting an array? The processor speed is fast Each record requires a large amount of memory In most standard situations where you want to sort many records None of the above

In most standard situations where you want to sort many records

When selecting a pivot value, a simple thing to do is to always pick from the same place in the partition. If we use this approach, does it matter whether we always pick from the first position in the partition, the last position in the partition, or the middle position in the partition? It doesn't really matter, they are all equally good or bad It is much better to pick the first value It is much better to pick the middle value It is much better to pick the last value

It is much better to pick the middle value

If it takes a given computer one second on average to run Quicksort on an array of 1000 records, how long (to the nearest thousand seconds) will it take to run Quicksort on 1,000,000 records? (Hint: You know from this statement that the machine can do about 10,000 comparisons per second. To get the answer, you first need to compute about how many total comparisons 1,000,000 records will require.)

2000

The order of the input records has what impact on the number of comparisons required by Quicksort (as presented in this module)? None There is a big difference, the asymptotic running time can change There is a constant factor difference

There is a big difference, the asymptotic running time can change

(For the version of the algorithm as presented in this module:) What is the running time of Quicksort when the input is an array where all record values are equal? Θ(n) Θ(n​^n​​) Θ(n^​2​​) Θ(logn) Θ(nlogn)

Θ(n^​2​​)

What is the average-case cost for Quicksort to sort an array of n elements? Θ(n​^2​​) Θ(nlogn) Θ(n) Θ(logn)

Θ(nlogn)

What is the best-case cost for Quicksort to sort an array of n elements? Θ(n​^2​​) Θ(nlogn) Θ(n) Θ(logn)

Θ(nlogn)

What is the worst-case cost for Quicksort to sort an array of n elements? Θ(n​^2​​) Θ(nlogn) Θ(n) Θ(logn)

Θ(n​^2​​)

Quicksort (as the code is written in this module) is a stable sorting algorithm. Recall that a stable sorting algorithm maintains the relative order of records with equal keys. True False

False

What is the worst-case cost for Quicksort's partition step? Θ(n​^2​​) Θ(nlogn) Θ(n) Θ(logn)

Θ(n)

A disadvantage of Quicksort is: It is stable Its worst-case running time is Θ(n​^2​​) Its average-case running time is Θ(n​^2​​) It needs an extra array for auxilliary storage

Its worst-case running time is Θ(n​^2​​)

After Quicksort completes the partition function, where is the pivot? Between the smaller values and the greater values in the partition The last position in the partition The first position in the partition The middle position in the partition

The last position in the partition


संबंधित स्टडी सेट्स

Direct and Multichannel Marketing

View Set

Counseling Diverse Populations Unit 4

View Set

Chapter 20: Viruses, Bacteria, and Archaea

View Set

Chem - Chapter 12 - Organic Chemistry 2 : Functional Groups

View Set

Chapter 1 -- HR Management: Gaining a Competitive A

View Set