Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Selection sort?

  1. Oct 30, 2009 #1
    if you have an array with size 1000000, would selection sort be feasible on a everyday laptop computer, or just too large?

    I imagine it would take (1Million)2/2 loops to complete the sort
     
  2. jcsd
  3. Oct 30, 2009 #2
    No, use your standard library sorting algo or google sorting and you will find many better ones, like quicksort, for example.
     
  4. Oct 31, 2009 #3

    rcgldr

    User Avatar
    Homework Helper

    I think what's he's asking is how long would it take to execute a small loop 1 trillion times on a modern lap top.

    From wiki

    http://en.wikipedia.org/wiki/Instructions_per_second

    Probably between 10 and 20 billion instructions per second, so 50 to 100 seconds per trillion instructions, assuming the condiitions mentioned in the wiki article. So ballpark about 100 seconds per instruction in that selective sort loop. This is a crude estimate, it could be 1000 seconds per trillion instructions when you take memory accesses into account.

    Here's a link to a prior thread about sorting which includes some links to source code of various sort programs:

    https://www.physicsforums.com/showthread.php?t=218369
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Selection sort?
  1. Sorting revisited. (Replies: 17)

  2. Sorting algorithm? (Replies: 2)

  3. Perfect sort (Replies: 2)

  4. Merge sort (Replies: 1)

  5. [Java] Selection Sort (Replies: 4)

Loading...