{ Insert.Inc                                     }
{ Sortierverfahren: Insert-Sort                  }
{ Uebergabeparameter:                            }
{        Class (das Array vom Typ StudentArray)  }
{        ClassSize (Letzte Datensatznummer)      }
{ Vordefiniert muss sein:                        }
{  StudentArray (TYPE StudentArray= Array Of ...)}
{  Student (Datentyp)                            }
{ Aufruf:                                        }
{ InsertSort (DatenArray, letzter Datensatz)     }

Procedure InsertSort (Var Class: StudentArray;
                      ClassSize: Integer);

Var i,j,k: Integer; { Schleifenvariablen }
    h:     Student; { Austauschvariable }

Begin                               { InsertSort }
 For i:=2 To ClassSize Do
 Begin
  h:=Class[i]; j:=1;
  While (h>class[j]) And (j<i) Do j:=j+1;
  If j<i Then For k:=i DownTo j+1 Do Class[k]:=
                                     Class[k-1];
  Class[j]:=h; { Class[j] einfuegen }
 End;
End;                                { InsertSort }

{ Ende Insert.Inc                                }

