@Test void testIsBST() { assertThat(isBST(TREE.root())).isTrue(); ParentAwareIntegerNode fifteen = ParentAwareIntegerNode.builder() .value(15) .build(); ParentAwareIntegerNode three = ParentAwareIntegerNode.builder() .value(3) .build(); ParentAwareIntegerNode five = ParentAwareIntegerNode.builder() .left(fifteen) .right(three) .value(5) .build(); three.setParent(five); fifteen.setParent(five); assertThat(isBST(five)).isFalse(); }
public ParentAwareIntegerNode root() { return rootNode; }
BinarySearchTree { public ParentAwareIntegerNode root() { return rootNode; } }
BinarySearchTree { public ParentAwareIntegerNode root() { return rootNode; } @Builder private  BinarySearchTree(Integer root, @Singular List<Integer> nodes); }
BinarySearchTree { public ParentAwareIntegerNode root() { return rootNode; } @Builder private  BinarySearchTree(Integer root, @Singular List<Integer> nodes); ParentAwareIntegerNode root(); List<Integer> nodes(); final ParentAwareIntegerNode insert(int value); final boolean contains(int value); final ParentAwareIntegerNode delete(int value); }
BinarySearchTree { public ParentAwareIntegerNode root() { return rootNode; } @Builder private  BinarySearchTree(Integer root, @Singular List<Integer> nodes); ParentAwareIntegerNode root(); List<Integer> nodes(); final ParentAwareIntegerNode insert(int value); final boolean contains(int value); final ParentAwareIntegerNode delete(int value);  }