-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
57 lines (46 loc) · 1.48 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
(function(){
const path = require('path');
const rl = require(path.resolve(__dirname, "./readline")).default;
const TRIE_DS = require(path.resolve(__dirname, "./ds-trie/index.js"));
const BST_DS = require(path.resolve(__dirname, "./ds-binary-search-tree/index.js"));
const HANOI_PS = require(path.resolve(__dirname, "./ps-tower-of-hanoi/index.js"));
const MERGE_SORT_PS = require(path.resolve(__dirname, "./ps-merge-sort/index.js"));
const askQuestions = () => {
rl.question(`\n\nWhat do you want to run?\n
1) Trie Data Structure.\n
2) Binary Search Tree.\n
3) Tower of Hanoi\n
4) Merge Sort\n
0) Exit\n:`,
(value) => {
let option = parseInt(value);
switch(option) {
case 0:
rl.close();
break;
case 1:
TRIE_DS.init();
break;
case 2:
BST_DS.init();
break;
case 3:
HANOI_PS.init();
break;
case 4:
MERGE_SORT_PS.init();
break;
default:
console.log("Invalid choice!!\n");
askQuestions();
}
});
};
const init = () => {
askQuestions();
};
init();
module.exports = {
default: init
};
})();