1 | export class ListNode {
|
2 | |
3 |
|
4 |
|
5 | next: ListNode | null;
|
6 | |
7 |
|
8 |
|
9 | prev: ListNode | null;
|
10 | }
|
11 |
|
12 |
|
13 |
|
14 | export class List<N extends ListNode> {
|
15 | |
16 |
|
17 |
|
18 | start: N | null;
|
19 | |
20 |
|
21 |
|
22 | end: N | null;
|
23 | len: number;
|
24 | }
|
25 | export function create<N extends ListNode>(): List<N>;
|
26 | export function isEmpty<N extends ListNode>(queue: List<N>): boolean;
|
27 | export function remove<N extends ListNode>(queue: List<N>, node: N): N;
|
28 | export function removeNode<N extends ListNode>(queue: List<N>, node: N): N;
|
29 | export function insertBetween<N extends ListNode>(queue: List<N>, left: N | null, right: N | null, node: N): void;
|
30 | export function replace<N extends ListNode>(queue: List<N>, node: N, newNode: N): void;
|
31 | export function pushEnd<N extends ListNode>(queue: List<N>, n: N): void;
|
32 | export function pushFront<N extends ListNode>(queue: List<N>, n: N): void;
|
33 | export function popFront<N extends ListNode>(list: List<N>): N | null;
|
34 | export function popEnd<N extends ListNode>(list: List<N>): N | null;
|
35 | export function map<N extends ListNode, M>(list: List<N>, f: (arg0: N) => M): M[];
|
36 | export function toArray<N extends ListNode>(list: List<N>): N[];
|
37 | export function forEach<N extends ListNode, M>(list: List<N>, f: (arg0: N) => M): void;
|
38 |
|
\ | No newline at end of file |