Browse Search Popular Register Upload Rules User list Login:
Search:
Radix Sort

Image:
screenshot of the scene

Author: homieeee

Group: Default

Filesize: 36.91 kB

Date added: 2014-11-13

Rating: 6.7

Downloads: 1030

Views: 550

Comments: 8

Ratings: 5

Times favored: 0

Made with: Algodoo v2.1.0

Tags:

Scene tag

Enjoy!:)

Radix sort has a run time of d*n, where d is the number of digits and n is the number of items. With an overall O(n) it is MUCH faster than bubble sorts O(n^2)

For those who want to know how it works:

A lexicographic sort does this (radix is a type of lexicographic sort)

Step 1: sort list by least significant digit
Step 2: sort list by the next significant digit
repeat till most significant digit is sorted and bam! sorted!

radix sort just uses buckets to sort by decimal number. (0-9)
You could also use any other stable sort if you wanted

It's awesome to watch since it's like a surprise sort!

Also there is a little bit of code i wrote after having trouble with indexes. I don't know if there's something better out there but it works for me!
Last edited at 2014/11/13 23:38:15 by homieeee
Please log in to rate this scene
edit
Similar scenes
Title: NEON PARTY (SORT OF 3D)
Rating: 5
Filesize: 267.42 kB
Downloads: 657
Comments: 0
Ratings: 1
Date added: 2024/06/24 06:30:25
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Mix and Sort
Rating: 5
Filesize: 357.32 kB
Downloads: 310
Comments: 0
Ratings: 1
Date added: 2017/12/24 14:26:37
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Miracle sort
Rating: 5
Filesize: 13.15 kB
Downloads: 413
Comments: 3
Ratings: 1
Date added: 2024/12/23 20:37:47
Made with: Algodoo v2.2.3
Rating: rated 5
download
Title: some sort of small slinky
Rating: 5
Filesize: 24.35 kB
Downloads: 461
Comments: 0
Ratings: 1
Date added: 2020/06/21 09:56:16
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Sort it Out
Rating: 5
Filesize: 219.4 kB
Downloads: 631
Comments: 0
Ratings: 1
Date added: 2016/04/06 16:18:25
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Rotary Ball Sort Lite (less code)
Rating: 5
Filesize: 100.9 kB
Downloads: 772
Comments: 9
Ratings: 1
Date added: 2024/08/10 00:22:36
Made with: Algodoo v2.1.0
Rating: rated 5
download
Yes, it's always fun to watch math in action! There are many algorithms that manipulate data in such a way that they produce beautiful and/or interesting patterns on the screen (Mandelbrot Fractals are just one example). This sort routine is no exception. Although it's not quite as beautiful as a fractal in the making, it is interesting to watch.

Suggestion:
After running the sort, I randomized the data by pressing the R key as described in your instruction, but when I clicked on the box to run another sort, it did not work. Then I recalled that your instruction said to reload the scene to run another sort. I suggest that you fix the code so that the user does not need to reload the scene (the script that begins with sim.time == 0 ? {....} would have to be modified so that you are not testing for zero sim.time.) Except for that minor nuisance, the scene was well made and it works as expected. Good job! :tup:
Thank you Xray! Fixed the reload thing and the sim.time==0 is just to set up vars when scene opens so no scene.my. vars go undefined!

Yeah i love making these type of scenes and watching them work! And as i get better at writing these algorithms hopefully i can make some beautiful things!
Incredible scripting!:o
Thank you faytree!
Nice work. Good coding, presentation, and explanation.:tup:
Thank you s_noonan!
awesome)
10/10
Thank you Alien_RG!