File tree 2 files changed +6
-4
lines changed
2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ complexity of the enqueue and dequeue operations are both $O(\log N)$.
80
80
81
81
## Usage
82
82
83
- * ` PriorityQueue `
83
+ * ` IPriorityQueue `
84
84
85
85
Member | Return | Description
86
86
:----------------------:|:-------------:|:---------------------------------------
@@ -97,7 +97,7 @@ complexity of the enqueue and dequeue operations are both $O(\log N)$.
97
97
``` typescript
98
98
export function createPriorityQueue<T >(
99
99
cmp : (x : T , y : T ) => -1 | 0 | 1 | number ,
100
- ): PriorityQueue <T >
100
+ ): IPriorityQueue <T >
101
101
```
102
102
103
103
- ` createPriorityQueue<number>((x, y) => x - y) ` : The top element has a maximum value .
Original file line number Diff line number Diff line change 4
4
* Priority queue can insert elements within the complexity of log(N) or remove
5
5
* the largest element in the queue.
6
6
*/
7
- export interface PriorityQueue < T > {
7
+ export interface IPriorityQueue < T > {
8
8
/**
9
9
* Initialize priority queue with initial elements.
10
10
* @param elements
@@ -48,7 +48,9 @@ export interface PriorityQueue<T> {
48
48
* side of the operator has higher precedence.
49
49
* @returns
50
50
*/
51
- export function createPriorityQueue < T > ( cmp : ( x : T , y : T ) => - 1 | 0 | 1 | number ) : PriorityQueue < T > {
51
+ export function createPriorityQueue < T > (
52
+ cmp : ( x : T , y : T ) => - 1 | 0 | 1 | number ,
53
+ ) : IPriorityQueue < T > {
52
54
const _tree : T [ ] = [ null as unknown as T ]
53
55
let _size = 0
54
56
You can’t perform that action at this time.
0 commit comments