@@ -76,7 +76,6 @@ public boolean contains(T value) {
76
76
77
77
// Recursive contains helper method.
78
78
private boolean contains (Node node , T value ) {
79
-
80
79
if (node == null ) return false ;
81
80
82
81
// Compare current value to the value in the node.
@@ -105,7 +104,6 @@ public boolean insert(T value) {
105
104
106
105
// Inserts a value inside the AVL tree.
107
106
private Node insert (Node node , T value ) {
108
-
109
107
// Base case.
110
108
if (node == null ) return new Node (value );
111
109
@@ -115,7 +113,6 @@ private Node insert(Node node, T value) {
115
113
// Insert node in left subtree.
116
114
if (cmp < 0 ) {
117
115
node .left = insert (node .left , value );
118
- ;
119
116
120
117
// Insert node in right subtree.
121
118
} else {
@@ -131,7 +128,6 @@ private Node insert(Node node, T value) {
131
128
132
129
// Update a node's height and balance factor.
133
130
private void update (Node node ) {
134
-
135
131
int leftNodeHeight = (node .left == null ) ? -1 : node .left .height ;
136
132
int rightNodeHeight = (node .right == null ) ? -1 : node .right .height ;
137
133
@@ -144,7 +140,6 @@ private void update(Node node) {
144
140
145
141
// Re-balance a node if its balance factor is +2 or -2.
146
142
private Node balance (Node node ) {
147
-
148
143
// Left heavy subtree.
149
144
if (node .bf == -2 ) {
150
145
@@ -212,7 +207,6 @@ private Node rightRotation(Node node) {
212
207
213
208
// Remove a value from this binary tree if it exists, O(log(n))
214
209
public boolean remove (T elem ) {
215
-
216
210
if (elem == null ) return false ;
217
211
218
212
if (contains (root , elem )) {
@@ -226,7 +220,6 @@ public boolean remove(T elem) {
226
220
227
221
// Removes a value from the AVL tree.
228
222
private Node remove (Node node , T elem ) {
229
-
230
223
if (node == null ) return null ;
231
224
232
225
int cmp = elem .compareTo (node .value );
0 commit comments