lru here we come
This commit is contained in:
parent
432f88550b
commit
8b4725a628
6 changed files with 34 additions and 3 deletions
|
|
@ -2,7 +2,7 @@
|
|||
"clearMocks": true,
|
||||
"moduleNameMapper": {
|
||||
"@code/(.*)": [
|
||||
"<rootDir>/src/day1/$1"
|
||||
"<rootDir>/src/day3/$1"
|
||||
]
|
||||
},
|
||||
"preset": "ts-jest"
|
||||
|
|
|
|||
|
|
@ -18,6 +18,6 @@
|
|||
"clear": "./scripts/clear",
|
||||
"prettier": "prettier --write ./src",
|
||||
"generate": "./scripts/generate",
|
||||
"day": "echo /home/mpaulson/personal/lig-machine/src/day1"
|
||||
"day": "echo /home/mpaulson/personal/lig-machine/src/day3"
|
||||
}
|
||||
}
|
||||
|
|
@ -35,6 +35,24 @@ const list_interface = {
|
|||
};
|
||||
|
||||
module.exports = {
|
||||
LRU: {
|
||||
generic: "<K, V>",
|
||||
type: "class",
|
||||
methods: [{
|
||||
name: "update",
|
||||
args: "key: K, value: V",
|
||||
return: "void",
|
||||
}, {
|
||||
name: "get",
|
||||
args: "key: K",
|
||||
return: "V | undefined",
|
||||
}],
|
||||
properties: [{
|
||||
name: "length",
|
||||
type: "number",
|
||||
scope: "public",
|
||||
}]
|
||||
},
|
||||
MinHeap: {
|
||||
type: "class",
|
||||
methods: [{
|
||||
|
|
|
|||
8
src/__tests__/LRU.ts
Normal file
8
src/__tests__/LRU.ts
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
import ArrayList from "@code/LRU";
|
||||
|
||||
test("LRU", function () {
|
||||
const lru = new LRU<number>(10);
|
||||
|
||||
lru.
|
||||
});
|
||||
|
||||
5
src/global.d.ts
vendored
5
src/global.d.ts
vendored
|
|
@ -31,3 +31,8 @@ declare type GeneralNode<T> = {
|
|||
value: T;
|
||||
children: GeneralNode<T>[];
|
||||
};
|
||||
|
||||
declare interface ILRU<K, V> {
|
||||
update(key: K, value: V): void;
|
||||
get(key: K): V | undefined;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
"baseUrl": "src",
|
||||
"paths": {
|
||||
"@code/*": [
|
||||
"day1/*"
|
||||
"day3/*"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue