Log in

View Full Version : [HELP] Struktur Data Task in C (Algo)


Braincode
11th November 2011, 01:56 PM
Ane dpt tugas tp blm ngerti master... :((

Ane sangat berterima kasih klo ada yg bisa bantu ane... http://ceri.ws/smilies/beautiful.gif

Task nya kyk gini:




Quote:





Pls modify the algorithm to meet this requirement:

You can know whether the program will halt/terminate immediately when it hits the first false value.



We know that it is no use to explore the rest of the tree when we have found one false value. Though the rest exploration returns true values, the AND operation will yield a false.



Checking whether the number of node at certain level is complete (max number of node possible)-version 2






Quote:





function checkCompNodeAtLevelBT(input p:addr,input level:integer,

input currLevel:integer)>boolean

{return true if the number of node at given level is the most possible;

otherwise return false}

kamus:



algoritma:

if level=0 or p=Nil then

> false

else

if level=1 and p≠Nil then

> true

else

if currLevel true

else

> false

else

> false

else

> countNodeAtLevelBT(p^.left,level,currLevel+1) and

countNodeAtLevelBT(p^.right,level,currLevel+1)






Quote:





Evaluation:



type addr:^elTree

type elTree:

type Tree:

.

.

.

T:Tree

...

level:integer=3 {tree level of interest}

...

if checkCompNodeAtLevelBT(T.root,level,1) then

output(�The tree has complete node at level�,level)

else

output(�The tree has incomplete node at level�,level)

.

.

.





Need help master... :mewek:

</div>