Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
eyas-ranjous committed Jul 13, 2024
1 parent c20eb81 commit 244a0be
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ A heap-based implementation of priority queue in javascript with typescript supp
* [front](#front)
* [back](#back)
* [dequeue (pop)](#dequeue-pop)
* [contains](#contains)
* [remove](#remove)
* [isEmpty](#isEmpty)
* [size](#size)
Expand Down Expand Up @@ -248,6 +249,16 @@ console.log(bidsQueue.pop()); // { id: 5, value: 12000 }
console.log(bidsQueue.pop()); // { id: 7, value: 8000 }
```

### contains
checks if the queue contains an element that meet a criteria in O(log(n)) runtime.

```js
carsQueue.contains((car) => car.price === 50000); // true
carsQueue.contains((car) => car.price === 200000); // false
numbersQueue.contains((n) => n === 4); // true
numbersQueue.contains((n) => n === 10); // false
```

### remove
removes all elements that meet a criteria in O(n*log(n)) runtime and returns a list of the removed elements.

Expand Down

0 comments on commit 244a0be

Please sign in to comment.