Truyen2U.Net quay lại rồi đây! Các bạn truy cập Truyen2U.Com. Mong các bạn tiếp tục ủng hộ truy cập tên miền mới này nhé! Mãi yêu... ♥

Cay DL

CAY:

Procedure duyettruoc(T)

S := nil;

If T ≠ nil Then spush(S,T);

While S ≠ nil do

Begin

Spop(S,P);

Tham nut boi p;

If lptr(p) ≠ nil Then

Spush(S,LPTR(p));

If rptr(p) ≠ nil Then

Spush(S,RPTR(p));

End;

Return;

------------------------------------

Procedure duyetgiua(T)

S :=nil;

P := T;

Repeat

While p ≠ nil Do

Begin

Spush(p,S);

End;

If S ≠ nil Then

Begin

Spop(S,p);

Tham nut tro boi p;

P := RPTR(p);

End;

Until (s =nil) and (p= nil);

Return;

-----------------------------------

Procedure chieucao(T);

If T = nil then chieucao := 0

Else chieucao := 1+

max(chieucao(LPTR(t),chieucao(RPTR(p));

Return;

---------------------------------

Function demnut(T);

If T = nil then demnut := 0

Else demnut := 1+ demnut(lptr(T))

+ demnut(rptr(T));

Return demnut;

----------------------------------------

Function demla(T)

If T = nil then demla :=0

Else if((LPTR(T) = nil) and (RPTR(T) = nil))

Then demla:= 1

Else

Demla:= demla(LPTR(T) + demla(RPTR(T));

Return demla;

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

Tags: