-1

这个短语在 Java 中是什么意思?我假设这意味着先前定义的名为“treeCopy”的变量正在调用其左源方法,该方法又分配给变量“leftCopy”。

我对么?远程关闭?完全错了吗?

    leftCopy = treeCopy(source.left);

    public static <E> BTNode<E> treeCopy(BTNode<E> source)
{
    BTNode<E> leftCopy, rightCopy;

    if (source == null)

        return null;
    else
    {
        leftCopy = treeCopy(source.left);

        rightCopy = treeCopy(source.right);

        return new BTNode<E>(source.data, leftCopy, rightCopy);
    }
}
4

3 回答 3

0

No one here can tell you what this code means beyond :

  • It's an assignment of some variable called leftCopy from the result of some method treeCopy
  • The method treeCopy takes a parameter, in this case whatever is in source.left
  • It won't execute because it's commented out

Consider reading how to ask a question.

于 2012-12-03T21:02:26.147 回答
0

There is a tree with a node or a root "Source" from source two branches emanate. A left and a right branch. TreeCopy is a function that takes a node as an input and returns a subtree in this case the left sub tree of source.

于 2012-12-03T21:03:35.443 回答
0

This code copies the left subtree of an binary tree.

于 2012-12-03T21:05:03.900 回答