feat: more algos
This commit is contained in:
parent
5a946a1f53
commit
5335cc10b0
16 changed files with 151 additions and 78 deletions
|
|
@ -1,20 +1,9 @@
|
|||
import LinkedList from "@code/DoublyLinkedList";
|
||||
import { test_list } from "./ListTest";
|
||||
|
||||
test("linked-list", function() {
|
||||
const list = new LinkedList<number>();
|
||||
|
||||
list.add(5);
|
||||
list.add(7);
|
||||
list.add(9);
|
||||
|
||||
expect(list.remove()).toEqual(5);
|
||||
expect(list.length).toEqual(2);
|
||||
|
||||
list.add(11);
|
||||
expect(list.remove()).toEqual(7);
|
||||
expect(list.remove()).toEqual(9);
|
||||
expect(list.remove()).toEqual(11);
|
||||
expect(list.remove()).toEqual(undefined);
|
||||
test("DoublyLinkedList", function() {
|
||||
const list = new LinkedList<number>(3);
|
||||
test_list(list);
|
||||
});
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue