MCPcopy Index your code
hub / github.com/careercup/ctci / isBST

Method isBST

java/CtCILibrary/CtCILibrary/TreeNode.java:53–67  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

51 }
52
53 public boolean isBST() {
54 if (left != null) {
55 if (data < left.data || !left.isBST()) {
56 return false;
57 }
58 }
59
60 if (right != null) {
61 if (data >= right.data || !right.isBST()) {
62 return false;
63 }
64 }
65
66 return true;
67 }
68
69 public int height() {
70 int leftHeight = left != null ? left.height() : 0;

Callers 1

mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected