@@ -85,7 +85,7 @@ export default class MinHeap {
8585
8686 while (
8787 MinHeap . hasParent ( currentIndex ) &&
88- MinHeap . lessThen ( this . heapContainer [ currentIndex ] , this . parent ( currentIndex ) )
88+ this . lessThen ( this . heapContainer [ currentIndex ] , this . parent ( currentIndex ) )
8989 ) {
9090 this . swap ( currentIndex , MinHeap . getParentIndex ( currentIndex ) ) ;
9191 currentIndex = MinHeap . getParentIndex ( currentIndex ) ;
@@ -101,14 +101,14 @@ export default class MinHeap {
101101 while ( this . hasLeftChild ( currentIndex ) ) {
102102 if (
103103 this . hasRightChild ( currentIndex ) &&
104- MinHeap . lessThen ( this . rightChild ( currentIndex ) , this . leftChild ( currentIndex ) )
104+ this . lessThen ( this . rightChild ( currentIndex ) , this . leftChild ( currentIndex ) )
105105 ) {
106106 nextIndex = MinHeap . getRightChildIndex ( currentIndex ) ;
107107 } else {
108108 nextIndex = MinHeap . getLeftChildIndex ( currentIndex ) ;
109109 }
110110
111- if ( MinHeap . lessThen ( this . heapContainer [ currentIndex ] , this . heapContainer [ nextIndex ] ) ) {
111+ if ( this . lessThen ( this . heapContainer [ currentIndex ] , this . heapContainer [ nextIndex ] ) ) {
112112 break ;
113113 }
114114
@@ -121,15 +121,15 @@ export default class MinHeap {
121121 return this . heapContainer . toString ( ) ;
122122 }
123123
124- static compare ( a , b ) {
124+ compare ( a , b ) {
125125 if ( a === b ) {
126126 return 0 ;
127127 }
128128
129129 return a < b ? - 1 : 1 ;
130130 }
131131
132- static lessThen ( a , b ) {
133- return MinHeap . compare ( a , b ) === - 1 ;
132+ lessThen ( a , b ) {
133+ return this . compare ( a , b ) === - 1 ;
134134 }
135135}
0 commit comments