Anda di halaman 1dari 1

for(int i = 0; i < n.

count; i++)
{
System.out.print(n.getValue(i)+" " );//this part prints root node
}
if(!n.leaf) //this is called when root is not leaf;
{
for(int j = 0; j <= n.count ; j++)//in this loop we recurse

{ //to print out tree in


if(n.getChild(j) != null) //preorder fashion.

{ //going from left most


System.out.println(); //child to right most
print(n.getChild(j)); //child.
}

Anda mungkin juga menyukai