1 | export class QueueNode {
|
2 | |
3 |
|
4 |
|
5 | next: QueueNode | null;
|
6 | }
|
7 |
|
8 |
|
9 |
|
10 | export class QueueValue<V> extends QueueNode {
|
11 | |
12 |
|
13 |
|
14 | constructor(v: V);
|
15 | v: V;
|
16 | }
|
17 | /**
|
18 | * @template {QueueNode} N
|
19 | */
|
20 | export class Queue<N extends QueueNode> {
|
21 | |
22 |
|
23 |
|
24 | start: N | null;
|
25 | |
26 |
|
27 |
|
28 | end: N | null;
|
29 | }
|
30 | export function create<N extends QueueNode>(): Queue<N>;
|
31 | export function isEmpty(queue: Queue<any>): boolean;
|
32 | export function enqueue<Q extends Queue<any>>(queue: Q, n: Q extends Queue<infer N extends QueueNode> ? N : never): void;
|
33 | export function dequeue<N extends QueueNode>(queue: Queue<N>): N | null;
|
34 |
|
\ | No newline at end of file |