Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

liliy Group Title

which is faster/better- heapsort or quicksort or merge sort { example :to order a million random numbers}

  • 2 years ago
  • 2 years ago

  • This Question is Closed
  1. rsmith6559 Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    For randomly ordered data, quicksort is the fastest. Quicksort's achilles heel is nearly sorted data, it becomes slow. Merge sort is slower than quicksort on random data, but doesn't deteriorate on nearly sorted data. Check out wikipedia, they have some great info on sorting.

    • 2 years ago
  2. liliy Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    but how abt heapsort?

    • 2 years ago
  3. KonradZuse Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    It's all about the Shell Sort baby!

    • 2 years ago
  4. krithika Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    As others have noted, worst case of Quicksort is O(n^2), while mergesort and heapsort stay at O(nlogn). On the average case, however, all three are O(nlogn); so they're for the vast majority of cases comparable. What makes Quicksort better on average is that the inner loop implies comparing several values with a single one, while on the other two both terms are different for each comparison. In other words, Quicksort does half as many reads as the other two algorithms. On modern CPUs performance is heavily dominated by access times, so in the end Quicksort ends up being a great first choice.

    • 2 years ago
    • Attachments:

See more questions >>>

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.