-
Notifications
You must be signed in to change notification settings - Fork 2
array_quicksort
Hyomoto edited this page Jun 13, 2021
·
5 revisions
| Jump To | Go Back |
Arguments |
|---|
Returns: [N/A undefined](N/A undefined)
Throws: InvalidArgumentType
A sort-in-place, non-stable sorting algorithm for arrays. If sort_or_func is true, or not provided, the array will be sorted by ascending value. Setting this to false will use descending logic. If a method is provided, this will be used for the comparison. For complex behaviors, the pivot can also be overriden. If an array is not provided to sort, a non-boolean, non-method is provided to the sort or pivot arguments, InvalidArgumentType will be thrown.
var _array = [ 10, 4, 15, 23, 12, 4 ];
array_quicksort( _array );
Output: [ 4,4,10,12,15,23 ]
| Name | Type | Purpose |
|---|---|---|
| array | array |
An array to sort |
| *sort_or_func | mixed |
optional: The sort logic to use |
| *pivot | [func](func) |
optional: A function to retrieve the pivot |
Devon Mullane 2020