Aufgabe im Anhang.
Lösung:
Was sagt ihr dazu?
Lösung:
Code:
public int nodesAtLevel(int n)
{
if(n<0 || isEmpty())
{
return 0;
}
else
{
if(n ==0)
{
if(leftchild.!isEmpty() || rightChild.!isEmpty())
{
return 1;
}
else
{
return 0;
}
return leftChild.nodesAtlevel(n-1) && rightChild.nodesAtLevel(n-1);
}
}
}
Was sagt ihr dazu?