Selection Sort on 1 Million Elements: Is It Feasible?

  • Thread starter Thread starter rsala004
  • Start date Start date
  • Tags Tags
    Elements Sort
AI Thread Summary
Selection sort is not feasible for sorting a large array of size 1,000,000 on an everyday laptop due to its inefficiency, requiring approximately 500 billion operations to complete. Modern laptops can execute between 10 to 20 billion instructions per second, which translates to an estimated sorting time of 50 to 100 seconds for a trillion instructions. However, considering memory access times, this could extend to around 1,000 seconds. It is recommended to use more efficient sorting algorithms, such as quicksort, available in standard libraries, rather than relying on selection sort for large datasets.
rsala004
Messages
23
Reaction score
0
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
 
Technology news on Phys.org
No, use your standard library sorting algo or google sorting and you will find many better ones, like quicksort, for example.
 
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
 
Thread 'Star maps using Blender'
Blender just recently dropped a new version, 4.5(with 5.0 on the horizon), and within it was a new feature for which I immediately thought of a use for. The new feature was a .csv importer for Geometry nodes. Geometry nodes are a method of modelling that uses a node tree to create 3D models which offers more flexibility than straight modeling does. The .csv importer node allows you to bring in a .csv file and use the data in it to control aspects of your model. So for example, if you...
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...
Back
Top