Ad
  • Custom User Avatar

    Not sure why this is happening...:

    expected:<[??????]> but was:<[??????]>

  • Custom User Avatar

    Does not work for test case:

    var leftBranch = new Node(1,undefined,new Node(2, undefined, new Node(3)));
    var rightBranch = new Node(1,undefined,new Node(2, undefined, new Node(3,undefined, new Node(4))));
    var newTree = new Node(0,leftBranch,rightBranch);
    Test.expect(!allLeavesAtSameLevel(newTree),'Should return false for a tree with leaves at different levels');

  • Custom User Avatar

    This is wrong. Consider a root node with 3 consecutive left nodes, and 4 consecutive right nodes. At the root of recursion, isEqual will equal 0 and the function will return true.