diff options
author | Jed Barber <jjbarber@y7mail.com> | 2015-10-17 14:20:48 +1100 |
---|---|---|
committer | Jed Barber <jjbarber@y7mail.com> | 2015-10-17 14:20:48 +1100 |
commit | 63c3043200de6b28a8c192f1b5625940435ea55e (patch) | |
tree | ab761edbbc71b2b2f28e0ef7e10b8adc58d44320 /selection.adb | |
parent | 5933f248c18914fbbce03102b340361a575eae3c (diff) |
Organised source code a bit, added makefile with clean target
Diffstat (limited to 'selection.adb')
-rw-r--r-- | selection.adb | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/selection.adb b/selection.adb deleted file mode 100644 index 1b49769..0000000 --- a/selection.adb +++ /dev/null @@ -1,42 +0,0 @@ - - -package body Selection is - - - procedure Swap(A, B : in out Element_T) is - Temp : Element_T; - begin - Temp := A; - A := B; - B := Temp; - end Swap; - - - function Find_Largest(Arr : in Array_T) return Index_T is - Max : Index_T; - begin - Max := Arr'First; - for P in Index_T range Index_T'Succ(Arr'First) .. Arr'Last loop - if Arr(P) > Arr(Max) then - Max := P; - end if; - end loop; - return Max; - end Find_Largest; - - - procedure Sort(Arr : in out Array_T) is - Largest : Index_T; - begin - if Arr'Length <= 1 then - return; - end if; - - Largest := Find_Largest(Arr); - Swap( Arr(Arr'Last), Arr(Largest) ); - Sort( Arr(Arr'First .. Index_T'Pred(Arr'Last)) ); - end Sort; - - -end Selection; - |