array_sorts.zip

Array Sorts

array_sorts.zip

4 Script files

All sorts are numerical!!! (as opposed to X3's string based one...why?!)

- lib.array.insertsort -Your basic insertion sort, is stable, single array
- lib.array.quicksort -Basic quick sort, is not stable, single array, is better then insertion sort if you can pick a better pivot (apparently?)
- lib.array.quicksort.recursive -DONT CALL THIS ONE!!! call the other one
- lib.array.insertsort.matrix -Insertion sort, is stable, does a matrix, max sort by 2 columns (optional sort up, sort down)

Leave col2 blank to sort by just col1

Garbage in Garbage out. It returns null if your matrix is not correctly sized (all columns are equal in size)

Array[C][R], Column, Row (C-> R, Alphabetical order). Don't get them confused!!!

-Alternatively, think like this: An array is a single column, an array of an array, is a whole lot of columns, ie. a row of columns. Thus, as you go DOWN a row, your going down the Inner array, so array[][down here]. So the second one is the row.

-Or just look at excel, it uses Column Row too (A1, B3, etc)