REVIEW WEBSITE MEDIAKOMEN.COM || WEBSITE DAFTAR JADI BUZZER || PENGHASIL UANG VIA WEBSITE || RECEHAN REVIEW WEBSITE MEDIAKOMEN.COM || WEBSITE DAFTAR JADI BUZZER || PENGHASIL UANG VIA WEBSITE || RECEHAN REVIEW WEBSITE MEDIAKOMEN.COM || WEBSITE DAFTAR JADI BUZZER || PENGHASIL UANG VIA WEBSITE || RECEHAN REVIEW WEBSITE MEDIAKOMEN.COM || WEBSITE DAFTAR JADI BUZZER || PENGHASIL UANG VIA WEBSITE || RECEHAN #REVIEWWEBSITE #penghasiluang #receh Berikut Link Webistenya : https://www.mediakomen.com/ 0:00:00 ▼ EXPAND FOR NAVIGATION ▼ 0:01 CH 0: Opening 0:08 CH 1: Story 0:10 CH 2: Closing
Program Pascal Binary Tree
Ok sob kali ini saya akan memposting sebuah program pascal binary tree beserta outputnya :
Lansgung aja sob...
--------------------------------------------------------------------------------------------------------------------------
Program binary;uses wincrt;
type
tptr = ^node;
node = record
left :tptr;
data : integer;
right : tptr;
end;
var
c,i,x,n: integer;
temp, trail, r, t : tptr;
procedure insert(x:integer; var t : tptr);
begin
new(temp);
temp^.left:=nil;
temp^.data:=x;
temp^.right:=nil;
r := t;
trail := nil;
while(r<>nil ) do
begin
trail := r;
if r^.data > x then
r := r^.left
else
r := r^.right;
end;
if trail=nil then
t := temp
else
if trail^.data > x then
trail^.left := temp
else
trail^.right := temp;
end;
procedure inOrder(t:tptr);
begin
if t <> nil then
begin
inOrder(t^.left);
write(t^.data:5);
inOrder(t^.right);
end;
end;
procedure postOrder(t:tptr);
begin
if t <> nil then
begin
postOrder(t^.left);
postOrder(t^.right);
write(t^.data:5);
end;
end;
procedure preOrder(t:tptr);
begin
if t <> nil then
begin
write(t^.data:5);
preOrder(t^.left);
preOrder(t^.right);
end;
end;
begin
t := nil;
writeln('banyak data : '); readln(n);
for i := 1 to n do
begin
write('input data ke-',i, ':'); readln(x);
insert(x,t);
end;
repeat
writeln;
writeln('1.inOrder');
writeln('2.preOrder');
writeln('3.postOrder');
writeln('4.exit');
writeln('ENTER YOUR CHOICE');
READ(C);
case c of
1 : inOrder(T);
2 : preOrder(T);
3 : postOrder(T);
4 : exit;
end;
until(c=4);
end.
--------------------------------------------------------------------------------------------------------------------------
OUTPUT
--------------------------------------------------------------------------------------------------------------------------
Nah itu lah code pascal binary tree, semoga bermanfaat . #Salam_Syntax_Error
Komentar
Posting Komentar