Introduction to Algorithms
Introduction to Algorithms
3rd Edition
ISBN: 9780262033848
Author: Thomas H. Cormen, Ronald L. Rivest, Charles E. Leiserson, Clifford Stein
Publisher: MIT Press
Question
Book Icon
Chapter 7.2, Problem 4E
Program Plan Intro

To argue that the procedure INSERTION-SORT would beat the procedure QUICKSORT on this problem.

Blurred answer
Students have asked these similar questions
Professor JAson uses the following algorithm for merging k sorted lists, each having n/k elements. He takes the first list and merges it with the second list using a linear-time algorithm for merging two sorted lists, such as the merging algorithm used in mergesort. Then, he merges the resulting list of 2n/k elements with the third list, merges the list of 3n/k elements that results with the fourth list, and so forth, until he ends up with a single sorted list of all n elements. Analyze the worst-case running time of the professor’s algorithm in terms of n and k.
We talked about the trade-off between using sequential search on an unsorted list as opposed to sorting the list and then using binary search. If the list size is n = 9,000, about how many worst-case searches must be done before the second alternative is better in terms of number of comparisons? (Hint: Let p represent the number of searches done.) Use selection search to sort the binary search list.
In this problem, consider a non-standard sorting algorithm called the Slow Sort. Given anarray A[1 : n] of n integers, the algorithm is as follows: Slow-Sort(A[1 : n]):1. If n < 100, run merge sort (or selection sort or insertion sort) on A.2. Otherwise, run Slow-Sort(A[1 : n −1]), Slow-Sort(A[2 : n]), and Slow-Sort(A[1 : n −1]) again. Question: Prove the correctness of Slow-Sort.
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning