type
TElementProby = record
Numer: Integer;
Prawdopodobienstwo: Double;
end;
TProba = array of TElementProby;
TModa = array of TElementProby;
procedure GetModa (Proba: TProba; var Moda: TModa);
var i: Integer;
begin
if Length(Proba)>0 then begin
SetLength(Moda,1);
Moda[0]:=Proba[0];
for i:=1 to Length(Proba)-1 do
if Proba[i].Prawdopodobienstwo=Moda[0].Prawdopodobienstwo then begin
SetLength(Moda,Length(Moda)+1);
Moda[Length(Moda)-1]:=Proba[i];
end else if Proba[i].Prawdopodobienstwo>Moda[0].Prawdopodobiestwo then begin
SetLength(Moda,1);
Moda[0]:=Proba[i];
end;
end else
SetLength(Moda,0);
end;
Zamiast prawdopodobieństwa może być np. częstość w próbie. Napisane na szybko i bez kompilacji więc za ewentualne błędy przepraszam.