Skip to content

Commit 4a60b9a

Browse files
authored
refactor: groups all data structures (TheAlgorithms#113)
* refactor: groups all data structures * refactor: groups hashing files in set/map folder
1 parent 63cbf8f commit 4a60b9a

27 files changed

+41
-41
lines changed
File renamed without changes.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { DoublyLinkedList } from "../doubly_linked_list";
2+
import { testLinkedList } from "./linked_list";
3+
4+
describe("DoublyLinkedList", () => {
5+
testLinkedList(DoublyLinkedList);
6+
7+
it("should reverse the list", () => {
8+
const list: DoublyLinkedList<number> = new DoublyLinkedList<number>();
9+
10+
list.append(1);
11+
list.append(2);
12+
list.append(3);
13+
list.reverse();
14+
15+
expect(list.get(0)).toBe(3);
16+
expect(list.get(1)).toBe(2);
17+
});
18+
19+
it("should return null for reverse when list is empty", () => {
20+
const list: DoublyLinkedList<number> = new DoublyLinkedList<number>();
21+
22+
expect(list.reverse()).toBeNull();
23+
});
24+
});

data_structures/hashing/hash_map.ts renamed to data_structures/map/hash_map.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Map } from "../map";
1+
import { Map } from "./map";
22

33
/**
44
* Represents a hash map.

data_structures/map.ts renamed to data_structures/map/map.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { HashMapEntry } from "./hashing/hash_map";
1+
import { HashMapEntry } from "./hash_map";
22

33
/**
44
* This interface is a representation of the Map data structure.

data_structures/hashing/test/hash_map.test.ts renamed to data_structures/map/test/hash_map.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { HashMap } from "../hash_map";
1+
import { HashMap } from "../../map/hash_map";
22

33
describe("Hash Map", () => {
44
let hashMap: HashMap<string, number>;
File renamed without changes.

0 commit comments

Comments
 (0)