. , , ,

,,,

- — ,

 


̻

-



- . QuickSort.

Delphi.

- Delphi :

1.         Windows .

2.         ; Windows , , , Windows.

3.         , , , .

4.         .

5.         , , ..

6.         , , .

7.         Windows, .

Delphi . Delphi 1995 , 1996 , 1997 , 1998 , 1999 , 2001 . , Delphi 2.0, 32- , .. Windows 95/98, NT .. 2002 , -.

- .


1.         DELPHI-

1.1

 

: InputForm ReportForm:

InputForm (. 1):

  AddBtn .

  CopyBtn .

  DelBtn .

  SortBtn .

  FindBtn .

  SaveBtn .

  LoadBtn .

  SaveBtn .

  FBtn ReportForm 5.

  BitBtn1 .

  MSpinEdit M.

  KSpinEdit .

Label1, Label2 OpenDialog1, SaveDialog1 .

  PageControl1 TabSheet 15 ( , , (), (), ()).

TabSheet 15 StringGrid 15, , Kvart, Scheme, GK, People, FlatAtr).

. 1

ReportForm (. 2):

  Panel1, Panel2 .

  OkBtn .

  ListBox1 .


. 2 5.

 

1.2 ,

:

:

Unit1 .

Unit2 .

MyTypes .

, :

 procedure LoadButtonClick .

 procedure SaveButtonClick .

 procedure FillStringGrid .

 procedure PageControl1Change .

 procedure SGDblClick  / .

 procedure AddBtnClick .

 procedure DelBtnClick .

 procedure SortBtnClick .

 procedure KSpinEditChange .

 procedure MSpinEditChange M .

 procedure CopyBtnClick .

 procedure FindBtnClick .

 procedure SortBtn .

 procedure FButtonClick ReportForm 5.

 procedure ReadVec .

 procedure WriteVec .


2.        

TVector FArr. FNames, array [1..100] of string. 5 TVector:

Kvart: TVector;

Scheme: TVector;

Gk: TVector;

People: TVector;

FlatAtr: TVector;

Kvart

TVector 100*100*16+10100+8=170108

Scheme

TVector 170108

Gk

TVector 170108

People

TVector 170108

FlatAtr

TVector 170108

, :

KPod, M, i, j, k, x, integer ( 4 );

FileNameT string (200 );

Ft TextFile (460 );

FSGVector TStringGrid (40 ).


3.        

TVector FArr .

FArr :

FArr: array [1..100] of TVarMas, TVarMas = array [1..MaxN] of Variant;

(array) () .

, , . .

FArr:

 

0

1

2

100

1

 

 

 

 

 

2

 

 

 

 

 

3

 

 

 

 

 

 

 

 

 

 

100

 

 

 

 

 

16 . FArr (100*100)*16=160000 .

FNames:

 

0

1

2

101

1

 

 

 

 

 

2

 

 

 

 

 

3

 

 

 

 

 

 

 

 

 

 

100

 

 

 

 

 

101 . FNames 100*101 =10100 .


4.        

QuickSort ( ).

(quicksort), qsort , . ( (n log n) n ), .

. :

1.         , . . , . : , , ; .

2.         : , , , , , . :

1.         l r, .

2.         m.

3.         l m , l- .

4.         r m , r- .

5.         r = l , .

6.         l < r l r, . , - (l r) , m r- l- .

3.         , .

4.         , . , , , . .

( ) , , , .

FArr TVector:

 // SortId xMode

 // xMode = 1

 // xMode = 2

 // xMode = 0- SortMode

procedure TVector. Sort (xMode: integer = 0);

procedure QSort (l, r: Integer);

function Less (var x, y: Variant): boolean;

begin

if (X < Y) and (SortMode=1) //

then Less:=true

else Less:=false;

end;

var

i, j, x: integer;

y: TVarMas; //Variant;

begin

i:= l; j:= r; x:= (l+r) DIV 2;

repeat

while Less (FArr[i] [SortId], FArr[x] [SortId]) do i:= i + 1;

while Less (FArr[x] [SortId], FArr[j] [SortId]) do j:= j 1;

if i <= j then

begin

y:= FArr[i];

FArr[i]:= FArr[j];

FArr[j]:= y;

i:= i + 1; j:= j 1;

end;

until i > j;

if l < j then QSort (l, j);

if i < r then QSort (i, r);

end;

begin {QuickSort};

if xMode<>0

then SortMode:= xMode;

QSort (1, Size);

if xMode=0 then //

begin

if SortMode = 1

then SortMode:=2 else SortMode:=1;

end;

end;

QuickSort ( ), , , . , .

           . . , , CN = 2CN/2+N. .

           . O (n log n) n . .

           2CN/2 ; N , . , CN = N lg N.

           . , , , . , , .

           O (n²) , , , . , n, n- .

 

 
5.

Delphi.

. (. . 3).

. 3

, , , . QuickSort. , ..

: , , .. () :

. = , .

=. 4 + 79 .

 / (. . 4)

. 4

25 (. . 5).

. 5

(. . 6)

. 6


, , .

() (. . 7).

. 7 ()

, , , .

(). (. . 8)

. 8 ()


() (). (. . 9)

. 9 ()

*.dat .

5 5, (. . 10). ʻ.

. 9 ()


(). Delphi - . Delphi.

. QuickSort.


1 .  / ..,  .. .: , 2004 176 .
2 .. Delphi 6. . - .: ̻, 2001. - 1024 .
3 . . - : , 2001. 352 .
4 . 4. :  // : = Introduction to The Design and Analysis of Algorithms. .: , 2006. . 174179.
5 ..  , 1. . - .: , 2002. -720 .
6 ..  , 3. . - .: , 2001. - 832 .
7  ..,  .. Delphi. . : -, 2003. 288 .:
 

1

unit Unit1;

interface

uses

Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,

StdCtrls, ExtCtrls, math, Grids, Buttons, Mask, Calendar, ComCtrls,

Spin, MyTypes, Unit2;

Type

TInputForm = class(TForm)

BitBtn1: TBitBtn;

OpenDialog1: TOpenDialog;

SaveDialog1: TSaveDialog;

LoadButton: TButton;

SaveButton: TButton;

PageControl1: TPageControl;

TabSheet1: TTabSheet;

TabSheet2: TTabSheet;

TabSheet3: TTabSheet;

StringGrid1: TStringGrid;

DelBtn: TBitBtn;

AddBtn: TBitBtn;

StringGrid2: TStringGrid;

SortBtn: TBitBtn;

TabSheet4: TTabSheet;

TabSheet5: TTabSheet;

StringGrid3: TStringGrid;

StringGrid4: TStringGrid;

StringGrid5: TStringGrid;

Label1: TLabel;

KSpinEdit: TSpinEdit;

Label2: TLabel;

MSpinEdit: TSpinEdit;

FindBtn: TBitBtn;

CopyBtn: TBitBtn;

FButton: TButton;

procedure FormCreate (Sender: TObject);

procedure LoadButtonClick (Sender: TObject);

procedure SaveButtonClick (Sender: TObject);

procedure PageControl1Change (Sender: TObject);

procedure AddBtnClick (Sender: TObject);

procedure SGDblClick (Sender: TObject);

procedure DelBtnClick (Sender: TObject);

procedure SortBtnClick (Sender: TObject);

procedure KSpinEditChange (Sender: TObject);

procedure MSpinEditChange (Sender: TObject);

procedure SGKeyPress (Sender: TObject; var Key: Char);

procedure FormDestroy (Sender: TObject);

procedure CopyBtnClick (Sender: TObject);

procedure FindBtnClick (Sender: TObject);

procedure FButtonClick (Sender: TObject);

private

{Private declarations}

public

{Public declarations}

 //Fz: file of TVector; //

KPod, M: integer; //

People: TVector; //

GK: TVector; //

Scheme: TVector; //

FlatAtr: TVector; //

KVART: TVector; //

Ft: TextFile; //

FileNameT: string[200]; //

FSGVector: array [1..10] of TStringGrid;

procedure FillStringGrid (SG: TStringGrid; Vec: TVector);

function GetVec: TVector;

procedure ReadVec (var Vec: TVector);

procedure WriteVec (Vec: TVector); //

end;

var

InputForm: TInputForm;

Implementation

{$R *.DFM}

procedure TInputForm. FormCreate (Sender: TObject);

begin

KPod:=2; M:= 3;

 //

Kvart:= TVector. Create;

Kvart. Cols:= 7;

Kvart. Names[1]:= ' ';

Kvart. Names[2]:= ' ';

Kvart. Names[3]:= ' ';

Kvart. Names[4]:= ' (. .)';

Kvart. Names[5]:= ' (. .)';

Kvart. Names[6]:= ' ';

Kvart. Names[7]:= '.';

 //

Scheme:= TVector. Create;

Scheme. Cols:= 4;

Scheme. Names[1]:= '. 1';

Scheme. Names[2]:= '. 2';

Scheme. Names[3]:= '. 3';

Scheme. Names[4]:= '. 4';

 //

GK:= TVector. Create;

GK. Cols:= 8;

GK. Names[1]:= ' ';

GK. Names[2]:= '';

GK. Names[3]:= '';

GK. Names[4]:= '';

GK. Names[5]:= ' ';

GK. Names[6]:= ' ';

GK. Names[7]:= '';

GK. Names[8]:= ' (. .)';

 //

 // 1.5. :

 // 1) ,

 // 2) ( / // / /),

 // 3) ,

 // 4)  /  /  / .

People:= TVector. Create;

People. Cols:= 4;

People. Names[1]:= '';

People. Names[2]:= '.-';

People. Names[3]:= ' ';

People. Names[4]:= '';

People. Names[5]:= ' ';

People. Names[6]:= '';

People. Names[7]:= ' (. .)';

 //

 // 1.6. ( ):

 // 1) ,

 // 2) ,

 // 3) (. .),

 // 4) ( ),

 // 5) ,

 // 6) ,

 // 7) ,

 // 8) ,

 // 9) .

FlatAtr:= TVector. Create;

FlatAtr. Cols:= 9;

FlatAtr. Names[1]:= ' .';

FlatAtr. Names[2]:= '';

FlatAtr. Names[3]:= '.. 1';

FlatAtr. Names[4]:= '.. 2';

FlatAtr. Names[5]:= '.. 3';

FlatAtr. Names[6]:= '.. 4';

FlatAtr. Names[7]:= '.';

FlatAtr. Names[8]:= '.';

FlatAtr. Names[9]:= '.';

 //

PageControl1Change(Sender);

FSGVector[1]:= StringGrid1;

FSGVector[2]:= StringGrid2;

FSGVector[3]:= StringGrid3;

FSGVector[4]:= StringGrid4;

FSGVector[5]:= StringGrid5;

end;

procedure TInputForm. ReadVec (var Vec: TVector);

var

x, i, j: integer;

St: String;

begin

Readln (Ft, x); Vec. Cols:= x;

for i:=1 to Vec. Cols do

begin Readln (Ft, St); Vec. Names[i]:= St; end;

Readln (Ft, x); Vec. Size:= x;

for i:=1 to Vec. Size do

begin

for j:=1 to Vec. Cols do

begin Readln (Ft, St); Vec.X [i, j]:= St; end;

end;

Vec. SortId:= 1;

Vec. SortMode:= 1;

end;

procedure TInputForm. WriteVec (Vec: TVector);

var i, j: integer;

begin

Writeln (Ft, Vec. Cols);

for i:=1 to Vec. Cols do

Writeln (Ft, Vec. Names[i]);

Writeln (Ft, Vec. Size);

for i:=1 to Vec. Size do

begin

for j:=1 to Vec. Cols do

Writeln (Ft, Vec.X [i, j]);

end;

end;

 //

procedure TInputForm. LoadButtonClick (Sender: TObject);

begin

OpenDialog1. Title:= ' '; //

if not OpenDialog1. Execute then exit;

 //

FileNameT:= OpenDialog1. FileName; //

AssignFile (Ft, FileNameT); // Fz

Reset(Ft); //

ReadVec(Kvart); //

ReadVec(Scheme);

ReadVec(GK);

ReadVec(People);

ReadVec(FlatAtr);

PageControl1Change(Sender);

CloseFile(Ft);

end;

procedure TInputForm. SaveButtonClick (Sender: TObject);

 //

begin

if not SaveDialog1. Execute then exit;

 //

begin

FileNameT:= SaveDialog1. FileName; //

AssignFile (Ft, FileNameT); // Fz

{$I-}

Rewrite(Ft); //

{$I+}

if not((IOResult = 0) and (FileNameT <> )) then

begin

Application. MessageBox (' !', '', MB_OK);

exit;

end;

end;

WriteVec(Kvart); //

WriteVec(Scheme);

WriteVec(GK);

WriteVec(People);

WriteVec(FlatAtr);

CloseFile(Ft); //

end;

 // StringGrid Vec

procedure TInputForm. FillStringGrid (SG: TStringGrid; Vec: TVector);

var i, j: integer;

begin

Sg. ColCount:= Vec. Cols+1;

if Vec. Size=0

then Sg. RowCount:=2

else Sg. RowCount:=Vec. Size+1;

for i:=1 to Vec. Cols do

Sg. Cells [i, 0]:= Vec. Names[i];

for i:=1 to Vec. Size do

begin

Sg. Cells [0, i]:= IntToStr(i);

for j:=1 to Vec. Cols do

Sg. Cells [j, i]:= Vec.X [i, j];

end;

Sg. ColWidths[0]:= 25;

end;

procedure TInputForm. PageControl1Change (Sender: TObject);

begin

case PageControl1. ActivePageIndex of

0: FillStringGrid (StringGrid1, Kvart);

1: FillStringGrid (StringGrid2, Scheme);

2: FillStringGrid (StringGrid3, GK);

3: FillStringGrid (StringGrid4, People);

4: FillStringGrid (StringGrid5, FlatAtr);

end;

end;

procedure TInputForm. AddBtnClick (Sender: TObject);

var

SG: TStringGrid;

Vec: TVector;

begin

Sg:= FSGVector [PageControl1. ActivePageIndex+1];

Vec:= GetVec;

Vec. Add;

FillStringGrid (SG, Vec);

end;

procedure TInputForm.SGDblClick (Sender: TObject);

var

NRooms, NKv, NKvart, NPod, NFloor: integer;

porch: array [0..MaxN] of integer;

SG: TStringGrid;

Vec: TVector;

i, j, x, k, l: integer;

InputString: String;

begin

Sg:= TStringGrid(Sender);

i:= Sg. Selection. Left;

j:= Sg. Selection. Top;

Vec:= GetVec;

if (i<1) then exit; //

 // StringGrid1

if (Sg. Name = 'StringGrid1') and (i in [2,3,4,5]) then

begin

Application. MessageBox (

' !'

'', MB_OK);

exit;

end;

InputString:= InputBox ('', ' ', Vec.X [j, i]);

if InputString=''

then exit;

SG. Cells [i, j]:= InputString;

Vec.X [j, i]:= InputString;


 // StringGrid1

if (Sg. Name = 'StringGrid1') and (i = 1) then

begin

NKvart:= Vec.X [j, i];

porch[0]:= 0; x:= 0;

for i:=1 to Scheme. Size do

begin

porch[i]:= 2;

if Scheme.X [i, 3]=''

then porch[i]:= 2

else if Scheme.X [i, 4]=''

then porch[i]:= 3 else porch[i]:=4;

if NKvart <= x + (porch[i]*M) then

begin

NPod:= i; //

NFloor:= (NKvart-x) div M +1; //

NKv:= (NKvart-x) mod M; // .

if NKv=0

then NKv:= M;

NRooms:= Scheme.X [i, NKv]; // -

 //

SG. Cells [2, j]:= IntToStr(NRooms); Vec.X [j, 2]:= NRooms;

 //

SG. Cells [3, j]:= IntToStr(NFloor); Vec.X [j, 3]:= NFloor;


for k:=1 to FlatAtr. Size do

begin

if FlatAtr.X [i, 1]= NRooms then //

begin

 //x . 4 = , ,

x:= 0;

for l:=1 to NRooms do

try

x:= x + StrToInt (FlatAtr.X [k, 2+l]);

except

end;

 //

Vec.X [j, 4]:= x; SG. Cells [4, j]:= Vec.X [j, 4];

x:= x + StrToInt (FlatAtr.X [i, 7])+StrToInt (FlatAtr.X [i, 8])+

StrToInt (FlatAtr.X [i, 9]);

 //

SG. Cells [5, j]:= IntToStr(x); Vec.X [j, 5]:= x;

break;

end;

end;

InputString:= ' '+IntToStr(NKvart)+

' '+IntToStr(NPod)+

' '+IntToStr(NFloor)+

' ('+IntToStr(NRooms)+' ()).';

Application. MessageBox (PChar(InputString), '', MB_OK);

exit;

end;

x:= x + porch[i]*M;

end;

Application. MessageBox (' ',

'', MB_OK);

SG. Cells [2, j]:= ; Vec.X [j, 2]:= ;

SG. Cells [3, j]:= ; Vec.X [j, 3]:= ;

end;

if (j>Vec. Size) then //

begin

Vec. Add; FillStringGrid (SG, Vec);

end;

end;

function TInputForm. GetVec: TVector;

begin

case PageControl1. ActivePageIndex of

0: result:= Kvart;

1: result:= Scheme;

2: result:= GK;

3: result:= People;

4: result:= FlatAtr;

else result:= Kvart;

end;

end;

procedure TInputForm. DelBtnClick (Sender: TObject);

var

SG: TStringGrid;

Vec: TVector;

i: integer;

begin

Sg:= FSGVector [PageControl1. ActivePageIndex+1];

i:= Sg. Selection. Top; //

Vec:= GetVec;

Vec. Delete(i);

FillStringGrid (SG, Vec);

end;

procedure TInputForm. SortBtnClick (Sender: TObject);

var

SG: TStringGrid;

Vec: TVector;

i: integer;

begin

Sg:= FSGVector [PageControl1. ActivePageIndex+1];

i:= Sg. Selection. Left; //

Vec:= GetVec;

if (i<1) then exit; //

Vec. SortId:= i; //

Vec. Sort;

FillStringGrid (SG, Vec);

end;

procedure TInputForm.KSpinEditChange (Sender: TObject);

begin

KPod:= KSpinEdit. Value;

end;

procedure TInputForm.MSpinEditChange (Sender: TObject);

begin

M:= MSpinEdit. Value;

end;

procedure TInputForm.SGKeyPress (Sender: TObject; var Key: Char);

begin

if Key =#13 then // Enter

SGDblClick(Sender);

end;

procedure TInputForm. FormDestroy (Sender: TObject);

begin

People. Destroy;

GK. Destroy;

Scheme. Destroy;

FlatAtr. Destroy;

Kvart. Destroy;

end;

procedure TInputForm. CopyBtnClick (Sender: TObject);

var

SG: TStringGrid;

Vec: TVector;

i: integer;

begin

Sg:= FSGVector [PageControl1. ActivePageIndex+1];

i:= Sg. Selection.top; //

Vec:= GetVec;

Vec. AddCopy(i);

FillStringGrid (SG, Vec);

end;

procedure TInputForm. FindBtnClick (Sender: TObject);

var

SG: TStringGrid;

Vec: TVector;

res,

Row, Col: integer;

InputString: String;

begin

Sg:= FSGVector [PageControl1. ActivePageIndex+1];

Col:= Sg. Selection. Left;

Row:= Sg. Selection. Top;

Vec:= GetVec;

if (Col<1) then exit; //

InputString:= InputBox ('', ' ', );

if InputString=''

then exit;

res:= Vec. Find (Col, Row, InputString);

if res=0 then

begin

Application. MessageBox (' !', '', MB_OK);

exit;

end;

Sg. Row:= res;

end;

procedure TInputForm.FButtonClick (Sender: TObject);

var

NKvart, NPod: integer;

fl, i, k, x, p: integer;

St, FIO: String;

begin

 //

ReportForm. ListBox1. Items. Clear;

ReportForm. ListBox1. Items. Add (

' C , , '+

' ');

for k:=1 to People. Size do

begin

NKvart:= People.x [k, 3]; //

fl:= 0;

for i:=1 to GK. Size do

begin

if Gk.X [i, 1]=NKvart then

begin fl:= 1; break; end;

end;

if (fl=0) or ((fl=1) and (Gk.X [i, 7]<>''))

then continue; // ;

FIO:= People.X [k, 1];


x:= 0; NPod:= 0;

for i:=1 to Scheme. Size do

begin

if Scheme.X [i, 3]=''

then p:= 2

else if Scheme.X [i, 4]=''

then p:= 3 else p:=4;

if NKvart <= x + (p*M) then

begin NPod:= i; break; end;

end;

for i:=1 to Kvart. Size do

if Kvart.X [i, 1]= NKvart then

begin //

St:= FIO+' . '+IntToStr(NKvart)+' '+IntToStr(NPod)+' '+

IntToStr (Kvart.X [i, 2])+' . ';

if Kvart.X [i, 7]=''

then St:= St + ' - '

else St:= St + ' - ';

 // : , , , ,

 // .

ReportForm. ListBox1. Items. Add(St);

end;

end;

ReportForm. ShowModal;

end;

end.


unit Unit2;

interface

uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls,

Buttons, ComCtrls, ExtCtrls;

type

TReportForm = class(TForm)

Panel1: TPanel;

Panel2: TPanel;

OKBtn: TButton;

CancelBtn: TButton;

ListBox1: TListBox;

private

{Private declarations}

public

{Public declarations}

end;

var

ReportForm: TReportForm;

implementation

{$R *.DFM}

end.


unit MyTypes;

interface

uses Sysutils, Contnrs;

const MaxN = 100;

type

TVarType = Variant; //TVarRec;

TVarMas = array [1..MaxN] of TVarType;

TVector = class (TInterfacedObject)

private

{Private declarations}

FArr: array [1..MaxN] of TVarMas; //source data

FNum: integer; //number of items

FCols: integer; //number of columns

FNames: array [1..MaxN] of String[MaxN]; //names of columns

function GetSize: Integer;

procedure SetSize (value: Integer);

function GetCols: Integer;

procedure SetCols (value: Integer);

procedure SetX (Index1, Index2: integer; value: TVarType);

function GetX (Index1, Index2: integer): TVarType;

procedure SetName (Index: integer; value: String);

function GetName (Index: integer): String;

public

SortId: integer; //

SortMode: integer; //

constructor Create;

property X [Index1, Index2: Integer]: TVarType read GetX write SetX;

property Names [Index: Integer]: String read GetName write SetName;

property Size: Integer read GetSize write SetSize;

property Cols: Integer read GetCols write SetCols;

procedure Sort (xMode: integer = 0);

procedure Add();

procedure AddCopy (Index: integer);

procedure Delete (Index: integer);

function Find (Col, Row: integer; Value: Variant): integer;

end;

implementation

constructor TVector. Create;

begin

FNum:= 0; SortId:= 0; SortMode:= 1;

end;

function TVector. GetSize: Integer;

begin result:= FNum; end;

procedure TVector. SetSize (value: Integer);

begin FNum:= value; end;

function TVector. GetCols: Integer;

begin result:= FCols; end;

procedure TVector. SetCols (value: Integer);

begin FCols:= value; end;

procedure TVector. SetX (Index1, Index2: integer; value: TVarType);

begin

FArr[Index1] [Index2]:= value;

end;

function TVector. GetX (Index1, Index2: integer): TVarType;

begin

result:= FArr[Index1] [Index2];

end;

function TVector. GetName (Index: integer): String;

begin

result:= FNames[Index];

end;

procedure TVector. SetName (Index: integer; value: String);

begin

FNames[Index]:= Value;

end;

procedure TVector. Add();

begin

FNum:= FNum + 1;

end;


procedure TVector. AddCopy (Index: integer);

begin

FNum:= FNum + 1;

FArr[FNum]:= FArr[Index];

end;

procedure TVector. Delete (Index: integer);

var i: integer;

begin

if FNum=0 then exit; //

for i:=Index+1 to FNum do //

FArr [I-1]:= FArr[I];

FNum:= FNum -1; //

end;

 // SortId xMode

 // xMode = 1

 // xMode = 2

 // xMode = 0 SortMode

procedure TVector. Sort (xMode: integer = 0);

procedure QSort (l, r: Integer);

function Less (var x, y: Variant): boolean;

begin

if (X < Y) and (SortMode=1) //

then Less:=true

else Less:=false;

end;

var

i, j, x: integer;

y: TVarMas; //Variant;

begin

i:= l; j:= r; x:= (l+r) DIV 2;

repeat

while Less (FArr[i] [SortId], FArr[x] [SortId]) do i:= i + 1;

while Less (FArr[x] [SortId], FArr[j] [SortId]) do j:= j 1;

if i <= j then

begin

y:= FArr[i];

FArr[i]:= FArr[j];

FArr[j]:= y;

i:= i + 1; j:= j 1;

end;

until i > j;

if l < j then QSort (l, j);

if i < r then QSort (i, r);

end;

begin {QuickSort};

if xMode<>0

then SortMode:= xMode;

QSort (1, Size);

if xMode=0 then //

begin

if SortMode = 1

then SortMode:=2 else SortMode:=1;

end;

end;

 // Value Col Row

 // 0

function TVector. Find (Col, Row: integer; Value: Variant): integer;

var i: integer;

begin

result:= 0;

for i:=Row to FNum do

if FArr[I] [Col] = Value then

begin result:= i; exit; end;

end;

end.

̻ - -

 

 

 

! , , , .
. , :