Question

out of the following four: 1.Bubble sort 2. Insertion sort 3. Quicksort 4. Mergesort a. Which...

out of the following four:

1.Bubble sort
2. Insertion sort
3. Quicksort
4. Mergesort

a. Which sorting methods perform best and worst for data sizes ≥ 25,000 when
the input data is random?
b. Which sorting methods perform best and worst for data sizes ≥ 25,000 when
the input data is 90% sorted?
c. Which sorting methods perform best and worst for data sizes ≥ 25,000 when
the input data is reverse sorted?
d. Which sorting methods perform best and worst for data sizes < 25,000 when
the input data is random?
e. Which sorting methods perform best and worst for data sizes < 25,000 when
the input data is 90% sorted?
f. Which sorting methods perform best and worst for data sizes <25,000 when the
input data is reverse-sorted?
g. What is the relationship between the running time and the data size for each
of the sorting methods when the input data is random? (Try to come up with a function –
need not be ‘exact’, but close)
 Bubble sort
 Insertion sort
 Mergesort
 Quicksort
h. Conclude which sorting method is better suited for data size >25,000 and under
what input data pattern (random, almost sorted and reversely sorted)

Homework Answers

Answer #1

a.) Best sorting method Mergesort And worst is Insertion sort.

b.) When a data is sorted then Insertion is best method and worst is Quicksort.

c.) mergesort is best in this case and worst is bubble sort.

d.) When ever a data is given rendom then merge sort is best with O(nlogn) and Insertion/ bubble both are worst.

e.) Data is sorted then Insertion is best and quicksort is worst .

f.) Almost same as part c merge sort is best and worst is bubble.

h.) At the conclusion merge sort O(n logn) is best in all the case .

Bubble and Insertion sort O(n^2) are worst except in case when data is almost sorted then quick sort is worst .

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Implement functions for insertion sort, quicksort, heapsort and merge sort that input an array of integers...
Implement functions for insertion sort, quicksort, heapsort and merge sort that input an array of integers and sort it in-place. Write a program that generates random integer arrays (hint: use seed appropriately to avoid generating same sequences) of lengths 10, 100, 1000, 10,000, 100,000, 1000,000, and then sorts each using each of the sorting functions from (a), and measures the time in nanoseconds. The program will repeat this process 30 times and will compute the average execution time for each...
Please answer the following Case analysis questions 1-How is New Balance performing compared to its primary...
Please answer the following Case analysis questions 1-How is New Balance performing compared to its primary rivals? How will the acquisition of Reebok by Adidas impact the structure of the athletic shoe industry? Is this likely to be favorable or unfavorable for New Balance? 2- What issues does New Balance management need to address? 3-What recommendations would you make to New Balance Management? What does New Balance need to do to continue to be successful? Should management continue to invest...
What tools could AA leaders have used to increase their awareness of internal and external issues?...
What tools could AA leaders have used to increase their awareness of internal and external issues? ???ALASKA AIRLINES: NAVIGATING CHANGE In the autumn of 2007, Alaska Airlines executives adjourned at the end of a long and stressful day in the midst of a multi-day strategic planning session. Most headed outside to relax, unwind and enjoy a bonfire on the shore of Semiahmoo Spit, outside the meeting venue in Blaine, a seaport town in northwest Washington state. Meanwhile, several members of...