QuickSort

Màu nền
Font chữ
Font size
Chiều cao dòng

procedure Quick_Sort(l,r);

begin

i:=l; j:=r; k:=(l+r) div 2;

x:=a[k];

repeat

While a[i] <x do i:=i+1;

while a[j] >x do j:=j-1;

if i<j then doi cho a[i] va a[j]

until i=j

if L<j-1 then quick_sort(l,j-1);

if j+1<r then quick_sort(j+1,r);

end;

begin

quick_sort(l,n);

end.

Bạn đang đọc truyện trên: Truyen2U.Pro

#ducduy