Skip to content

Commit

Permalink
lru here we come
Browse files Browse the repository at this point in the history
  • Loading branch information
mpaulson committed Aug 10, 2022
1 parent 432f885 commit 8b4725a
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .jest.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"clearMocks": true,
"moduleNameMapper": {
"@code/(.*)": [
"<rootDir>/src/day1/$1"
"<rootDir>/src/day3/$1"
]
},
"preset": "ts-jest"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
18 changes: 18 additions & 0 deletions scripts/dsa.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: [{
Expand Down
8 changes: 8 additions & 0 deletions src/__tests__/LRU.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import ArrayList from "@code/LRU";

test("LRU", function () {
const lru = new LRU<number>(10);

lru.
});

5 changes: 5 additions & 0 deletions src/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"baseUrl": "src",
"paths": {
"@code/*": [
"day1/*"
"day3/*"
]
}
},
Expand Down

0 comments on commit 8b4725a

Please sign in to comment.