Skip to content

Commit

Permalink
feat(heap): add is empty method to check if the heap is empty or not
Browse files Browse the repository at this point in the history
  • Loading branch information
khaledosama999 committed Mar 5, 2021
1 parent 5525d3f commit 5305000
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/binary-heap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,8 @@ abstract class BinaryHeap<T, U> {
}
}

public delete(fn: (x:T)=>boolean) {
for (let index = 0; index < this.array.length; index += 1) {
if (fn(this.array[index])) {

}
}
public isEmpty() {
return this.array.length === 0;
}

protected parent(index: number) {
Expand Down

0 comments on commit 5305000

Please sign in to comment.