File tree Expand file tree Collapse file tree 2 files changed +0
-33
lines changed Expand file tree Collapse file tree 2 files changed +0
-33
lines changed Original file line number Diff line number Diff line change 22
33const {
44 Array,
5- ArrayPrototypeIndexOf,
65 Symbol,
76} = primordials ;
87
@@ -105,17 +104,6 @@ module.exports = class PriorityQueue {
105104 }
106105 }
107106
108- remove ( value ) {
109- const heap = this [ kHeap ] ;
110- const pos = ArrayPrototypeIndexOf ( heap , value ) ;
111- if ( pos < 1 )
112- return false ;
113-
114- this . removeAt ( pos ) ;
115-
116- return true ;
117- }
118-
119107 shift ( ) {
120108 const heap = this [ kHeap ] ;
121109 const value = heap [ 1 ] ;
Original file line number Diff line number Diff line change @@ -43,27 +43,6 @@ const PriorityQueue = require('internal/priority_queue');
4343 assert . strictEqual ( queue . shift ( ) , undefined ) ;
4444}
4545
46- {
47- // Checks that remove works as expected.
48- const queue = new PriorityQueue ( ) ;
49- for ( let i = 16 ; i > 0 ; i -- )
50- queue . insert ( i ) ;
51-
52- const removed = [ 5 , 10 , 15 ] ;
53- for ( const id of removed )
54- assert ( queue . remove ( id ) ) ;
55-
56- assert ( ! queue . remove ( 100 ) ) ;
57- assert ( ! queue . remove ( - 100 ) ) ;
58-
59- for ( let i = 1 ; i < 17 ; i ++ ) {
60- if ( removed . indexOf ( i ) < 0 )
61- assert . strictEqual ( queue . shift ( ) , i ) ;
62- }
63-
64- assert . strictEqual ( queue . shift ( ) , undefined ) ;
65- }
66-
6746{
6847 // Make a max heap with a custom sort function.
6948 const queue = new PriorityQueue ( ( a , b ) => b - a ) ;
You can’t perform that action at this time.
0 commit comments