Public void preorder (tree t)
{
Stack s1;
While ( t!=null)
System.out.println(t.getdata())
If(t.getRight()!=null);
s1.push(t.getRight());
if (t.getLeft()!=null
t=t.getleft();
else
if (!s1.empty())
t=s1.pop();
else
t=null
}
Public int countLeaves(tree t)
{
If (t==null)
return 0;
else
{
If(t.getLeft()==null) && t.getRight()==null)
return 1+countLeaves(t.getLeft()+countLeaves(t,getleft)تم تعديل هذه المشاركة بواسطة nardien28 في 5 يناير 2007 في 20:51