@@ -6,7 +6,6 @@ class BinarySearchTree {
66 constructor ( value ) {
77 if ( ! value ) throw new Error ( 'Root node value required' ) ;
88 this . root = new Node ( value ) ;
9- this . BSTUtils = BSTUtils ;
109 }
1110
1211 isEmpty ( ) {
@@ -16,37 +15,37 @@ class BinarySearchTree {
1615 /** Layered methods to simplify the BST API using utils under the hood */
1716
1817 add ( value ) {
19- return this . BSTUtils . insert ( this . root , value ) ;
18+ return BSTUtils . insert ( this . root , value ) ;
2019 }
2120
2221 preorder ( ) {
23- return this . BSTUtils . preorder ( this . root ) ;
22+ return BSTUtils . preorder ( this . root ) ;
2423 }
2524
2625 postorder ( ) {
27- return this . BSTUtils . postorder ( this . root ) ;
26+ return BSTUtils . postorder ( this . root ) ;
2827 }
2928
3029 inorder ( ) {
31- return this . BSTUtils . inorder ( this . root ) ;
30+ return BSTUtils . inorder ( this . root ) ;
3231 }
3332
3433 search ( value ) {
35- return this . BSTUtils . search ( this . root , value ) ;
34+ return BSTUtils . search ( this . root , value ) ;
3635 }
3736
3837 getMinimum ( ) {
39- const minNode = this . BSTUtils . findMinNode ( this . root ) ;
38+ const minNode = BSTUtils . findMinNode ( this . root ) ;
4039 return minNode . value ;
4140 }
4241
4342 getMaximum ( ) {
44- const maxNode = this . BSTUtils . findMaxNode ( this . root ) ;
43+ const maxNode = BSTUtils . findMaxNode ( this . root ) ;
4544 return maxNode . value ;
4645 }
4746
4847 remove ( value ) {
49- this . root = this . BSTUtils . delete ( this . root , value ) ;
48+ this . root = BSTUtils . delete ( this . root , value ) ;
5049 }
5150}
5251
0 commit comments