Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit69c3a16

Browse files
committed
Refactor LRU Cache.
1 parentfbd7755 commit69c3a16

File tree

2 files changed

+21
-19
lines changed

2 files changed

+21
-19
lines changed

‎src/data-structures/lru-cache/LRUCache.js

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
1-
/* eslint-disable no-param-reassign */
2-
importLinkedListNodefrom'./LinkedListNode';
1+
/* eslint-disable no-param-reassign, max-classes-per-file */
2+
3+
/**
4+
* Simple implementation of the Doubly-Linked List Node
5+
* that is used in LRUCache class below.
6+
*/
7+
classLinkedListNode{
8+
/**
9+
* Creates a doubly-linked list node.
10+
*@param {string} key
11+
*@param {any} val
12+
*@param {LinkedListNode} prev
13+
*@param {LinkedListNode} next
14+
*/
15+
constructor(key,val,prev=null,next=null){
16+
this.key=key;
17+
this.val=val;
18+
this.prev=prev;
19+
this.next=next;
20+
}
21+
}
322

423
/**
524
* Implementation of the LRU (Least Recently Used) Cache

‎src/data-structures/lru-cache/LinkedListNode.js

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp