1. Trang chủ
  2. » Giáo án - Bài giảng

Cac thuat toan sap xep

25 1,5K 4
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Cac Thuat Toan Sap Xep
Trường học University of Computer Science and Technology
Chuyên ngành Computer Science
Thể loại Bai Tap Lon
Năm xuất bản 2023
Thành phố Hanoi
Định dạng
Số trang 25
Dung lượng 108 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

OUTTEXTXY10,2,'Chuong trinh HeapSort'; VEKHUNG1A; SETTEXTSTYLEDEFAULTFONT,HORIZDIR,1;... Ob_ject.Menuchinh;Closegraph; readln;END.

Trang 2

if k=0 then j:=850;

settextstyle(2,0,6);

setcolor(15);

outtextxy(j,420,'Nhan Phim Bat Ky de Tiep Tuc ');

outtextxy(k,420,'Nhan Phim Bat Ky De Tiep Tuc ');

delay(10);

duongchay(0,422,getmaxx,439,1);

until (keypressed) or (i>1500);

if i>5 then exit;

writeln('Mang can sap co ',n,' phan tu:');

writeln('Gia tri cua cac phan tu 3<a[i]<=30:');

Trang 3

until (a[i]>3) and (a[i]<=30);

end;

clrscr;

writeln('Mang can sap co ',n,' phan tu:'); writeln;

for j:=1 to i do writeln('a[',j,']= ',a[j]);

Trang 4

outtextxy(150,450,'An phim bat ky de tiep tuc, Esc de thoat !');for i:= 1 to n do

Trang 6

outtextxy(100,300,'An phim bat ky de tiep tuc,');

outtextxy(100,320,'An Esc de thoat !');

Trang 7

for i:=n downto 1 do

outtextxy(100,300,'An phim bat ky de tiep tuc,');

outtextxy(100,320,'An Esc de thoat !');

setcolor(15);

outtextxy(80,280,'Mang da duoc sap xep.');

outtextxy(80,300,'An Enter de ve menu chinh !');

Trang 9

end;

end;

xoa(100,200,30);

for i:=1 to n do xoa(tamx[i],tamy[i],30);

for i:=1 to n do tron(tamx[i],tamy[i],b[i]);

Trang 13

GETMEM(Q,L);

GETIMAGE(X1-R2,Y1-R1,X1+R2,Y1+R1,P^);GETIMAGE(X2-R2,Y2-R1,X2+R2,Y2+R1,Q^);

Trang 15

OUTTEXTXY(10,2,'Chuong trinh HeapSort');

VEKHUNG1(A);

SETTEXTSTYLE(DEFAULTFONT,HORIZDIR,1);

Trang 16

line(tamx[i], tamy[i], tamx[2*i], tamy[2*i]);

if 2*i<n then line(tamx[i], tamy[i], tamx[2*i+1], tamy[2*i+1]);

end;

end;

Procedure Heap_sort(var x:mang; p:integer);

var

Trang 18

xoa(tamx[i div 2],tamy[i div 2],x[i div 2]);

line(tamx[i],tamy[i],tamx[i div 2], tamy[i div 2]);

Trang 19

tron(tamx[i div 2],tamy[i div 2],x[i div 2]);

for i:=2 to 3 do begin tamx[i]:=i*220-140; tamy[i]:=150; end;

for i:=4 to 7 do begin tamx[i]:=i*120-260; tamy[i]:=220; end;

for i:=8 to n do begin tamx[i]:=(i-1)*100-550;tamy[i]:=320; end;

dt; for i:=1 to n do tron(tamx[i],tamy[i],Item[i]);

Trang 24

outtextxy(150,210,'GOOBYE, SEE YOU AGAIN !');

Phim[1]:=' Selection Sort ';

Phim[2]:=' Insertion Sort ';

Phim[3]:=' Bubble Sort ';

Phim[4]:=' Shell Sort ';

Phim[5]:=' Quick Sort ';

Phim[6]:=' Heap Sort ';

Phim[7]:=' Merge Sort ';

Phim:=' Exit ';

while (chon<>8) do

begin

obj.Move(8,230,80,380,110,4,true,phim,3,7,yellow,green,chon);

if chon=1 then Selection;

if chon=2 then Insertion;

if chon=3 then Bubble;

if chon=4 then Shellsort;

if chon=5 then Quick;

if chon=6 then Heapsort;

if chon=7 then Mergesort;

if (chon=8) and (ok) then

Trang 25

Ob_ject.Menuchinh;Closegraph; readln;END

Ngày đăng: 21/08/2013, 07:10

TỪ KHÓA LIÊN QUAN

w