Hello! I’ve recently created a quicksort module that is able to order arrays incredibly fast and I would like to open source it. I know this may sound useless, but hear me out.
For this reason, I created my quicksort module. This module uses an algorithm known as quicksort to sort number arrays as fast as computationally and physically possible (Please refer below for more info).
Detailed description
Compared to all other sorting algorithms, quicksort has the fastest and most reliable time complexity of (in the best case) O(n log n)
. In the worst-case quicksort has a time complexity of O(n)
(which is still faster than most sorting algorithms)!
This module currently only has 2 built-in functions, but I will be adding more down the line.
-
module.sortArray(array)
- Set an array to this function and the array will be sorted. -
module.printTable(table)
- Prints all the entries inside of a table.
While yes, the built-in table-sort function may already use quick sort, my module comes with some advantages.
- Customizability
- Open-source
Here is a link to the Roblox model if you’re interested - https://www.roblox.com/library/6129195525/Quicksort-Module
I haven’t figured out a way to use tick()
to measure my module’s true speed, but if anyone could figure out how to do so, please let me know! (And no, quicksort cannot yet sort tables containing strings).
Feel free to contribute to the project by leaving suggestions here on this post or messaging me.
I made a GitHub with the source code and license if anyone wants to take a look at that (Under the incense of which you agree not to redistribute this module under your own name)!