78.3k views
1 vote
Estimate how many times faster quicksort will sort an array of one million random numbers than insertion sort.

2 Answers

5 votes

Final answer:

Quicksort is generally faster than insertion sort for sorting a large number of random numbers. For an array of one million random numbers, quicksort can be estimated to be around 10,000 times faster than insertion sort.

Step-by-step explanation:

Quicksort is generally faster than insertion sort for sorting a large number of random numbers. The time complexity of quicksort is O(n log n), while the time complexity of insertion sort is O(n^2).

For an array of one million random numbers, quicksort can be estimated to be around 10,000 times faster than insertion sort. This estimation can be made by comparing the number of operations performed by each algorithm.

Quicksort divides the array into smaller subarrays pivot, and sorts them recursively. Insertion sort inserts each element of the array into its proper position. The number of operations increases exponentially with the size of the array for insertion sort, while the number of operations increases logarithmically for quicksort.

User Huntar
by
7.9k points
7 votes
the answer is B hope this helped
User Machunter
by
8.3k points