function InsertIfEnough(const Value: Integer; var Table: array of Integer): Integer; var Max,Index : Integer; begin Max := High(Table); Index := Max; if Value < Table[Index] then result := -1 else begin while (Value > Table[Index]) and (index > -1) do begin if Index < Max then Table[Index+1] := Table[Index]; Table[Index] := Value; Index := Index-1; end; result := index+1; end; end; function InsertIfEnoughNS(const Value: Integer; var Table: array of Integer): Integer; var VMin,IMin, Len, N : Integer; begin Len := High(Table); IMin := Len; For N := 0 to Len-1 do if Table[N] < Table[IMin] then IMin := N; if Table[IMin] < Value then Table[IMin] = Value; result := IMin; end;
Vous n'êtes pas encore membre ?
inscrivez-vous, c'est gratuit et ça prend moins d'une minute !
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.