I wish to be able to sort an array of TIntArray by the first "sub-columen" (first index in each subarray) where the int the resulting order is Hi-Low/Low-Hi.
EG:
ATIA := [[10,0,1], [43,1,1], [13,5,7]];
ATIA := SomeSortingAlgo(ATIA, index:=0);
ATIA := [[43,1,1], [13,5,7], [10,0,1]];
Is there any simple way to do this in SCAR, or do would I need to write an algorithm for sorting the ATIA by first index in each nested array my self?
Also, just while i'm here, I would like to know why I cant simply do this:
var
ATIA: T2DIntArray;
begin
ATIA := [[10,0,1], [43,1,1], [13,5,7]];
end.
//I gotta do this..:
var
ATIA: T2DIntArray;
begin
SetLength(ATIA,3)
ATIA[0] := [10,0,1];
ATIA[1] := [43,1,1];
ATIA[2] := [13,5,7];
end.
//Edit:
- The sorting part is solved. Modified an algo that Freddy posted last year to fit my use.
Yet, I wish to know if there's a function built in for this.. Also, question two stands unsolved.