File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,18 @@ export class MyLinkedList<T = number> {
7
7
this . #freq_list_head. next = this . #freq_list_tail;
8
8
this . #freq_list_tail. prev = this . #freq_list_head;
9
9
}
10
-
10
+ isEmpty ( ) {
11
+ return this . #freq_list_head. next === this . #freq_list_tail;
12
+ }
13
+ clear ( ) {
14
+ this . #freq_list_head. next = this . #freq_list_tail;
15
+ this . #freq_list_tail. prev = this . #freq_list_head;
16
+ }
17
+ last_node ( ) {
18
+ return this . #freq_list_tail. prev === this . #freq_list_head
19
+ ? null
20
+ : this . #freq_list_tail. prev ;
21
+ }
11
22
first_node ( ) {
12
23
return this . #freq_list_head. next === this . #freq_list_tail
13
24
? null
@@ -29,7 +40,7 @@ export class MyLinkedList<T = number> {
29
40
}
30
41
insert_After (
31
42
prev_node : DoublyLinkedList < T > ,
32
- new_node : DoublyLinkedList < T > ,
43
+ new_node : DoublyLinkedList < T >
33
44
) : void {
34
45
const next = prev_node . next ;
35
46
const prev = prev_node ;
You can’t perform that action at this time.
0 commit comments