Vote UpVote

Generic musings

The Programming Works – Delphi (as Pascal descendant) has always had powerful type system. Consider the following sample code implementing simple insertion sort algorithm (I use Delphi 2009): unit InsSort; interface type TItem = Integer; TArray = array of TItem; procedure InsertionSort(var A: TArray); implementation procedure InsertionSort(var A: TArray); var I, J: Integer; Item: TItem; begin for I:= 1 + Low(A) to High(A) do begin Item:= A[I]; J:= I - 1; while (J >= Low(A)) and (A[J] > Item) do begin A[J + 1]:= A[J]; Dec(J); end; A[J + 1]:= Item; end; end; The ...
Favorite? Off-Topic? Serg @ 2011-05-10 16:24


Visits: 775
Votes: 1
Favorites: 0
Off-Topic: 0

Visits by Source

User Actions

Users who voted for this posting

Alister Christie
Contact us to advertise on DelphiFeeds.com

Community Links

Torry Firebird News


Please login or register to use this functionality.
(click on this box to dismiss)