MCPcopy Create free account
hub / github.com/careercup/ctci / insert

Method insert

java/Chapter 11/Question11_8/RankNode.java:12–27  ·  view source on GitHub ↗
(int d)

Source from the content-addressed store, hash-verified

10 }
11
12 public void insert(int d) {
13 if (d <= data) {
14 if (left != null) {
15 left.insert(d);
16 } else {
17 left = new RankNode(d);
18 }
19 left_size++;
20 } else {
21 if (right != null) {
22 right.insert(d);
23 } else {
24 right = new RankNode(d);
25 }
26 }
27 }
28
29 public int getRank(int d) {
30 if (d == data) {

Callers 1

trackMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected