CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2004
    Posts
    7

    Question quick, heap, and merge sorts comparison

    On the basis of their actual run-time formulas (not just their O-notation), what is the order of the average case running times of Heap sort, Merge sort, and Quciksort from fastest to slowest? I know that Heap sort is faster than merge sort, so the real quest is, which is fastest between Merge sort and Quicksort?
    Last edited by bdadbin; December 6th, 2004 at 07:22 PM.

  2. #2
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125

    Re: quick, heap, and merge sorts comparison

    And yet another.....

    Don't you believe in doing any honest work yourself. Write some code, measure the results, analyze the various standard implementations,
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  3. #3
    Join Date
    Dec 2004
    Posts
    7

    Thumbs up Re: quick, heap, and merge sorts comparison

    oh i agree w/ you 100%, but it would be impractical to do so considering its finals week and im trying to cram for finals ... thanks for your smart *** remark, though ...it did me a lot of help.
    Last edited by bdadbin; December 7th, 2004 at 03:44 AM.

  4. #4
    Join Date
    Feb 2002
    Posts
    4,640

    Re: quick, heap, and merge sorts comparison

    So, perform the experiment after finals. Unless, this is really a schoolwork related question.

    Viggy

  5. #5
    Join Date
    Feb 2004
    Location
    USA - Florida
    Posts
    729

    Re: quick, heap, and merge sorts comparison

    This is really dependant on the data and how they're ordered in the (unsorted) array (as well as factors such as computer speed, compiler used, language used, optimizations used, the mood you're in when you're writing the test cases, etc.). As a (very) general case, quicksort is generally faster out of the 3, however it does have a worst-case running-time so it's also the slowest of the three.
    Last edited by cma; December 7th, 2004 at 11:01 AM.
    Hungarian notation, reinterpreted? http://www.joelonsoftware.com/articles/Wrong.html

  6. #6
    Join Date
    Dec 2004
    Posts
    7

    Re: quick, heap, and merge sorts comparison

    To MrViggy, this is for finals. And to cma, thank you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured