forked from zhoutk/js-data-struct
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
92 lines (76 loc) · 2.02 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/***************************************************************************
> File Name : index.js
> Author : zhoutk
> Mail : zhoutk@189.cn
> Create Time : 2015-09-18 10:44
***************************************************************************/
var LinkedList = require('./LinkedList');
var DList = require('./DoubleLinkedList');
var Dictionary = require('./Dictionary');
var Hashtable = require('./hashtable');
var BSTree = require('./BSTree');
var Graph = require('./Graph');
var llist = new LinkedList();
var dlist = new DList();
var dic = new Dictionary();
var ht = new Hashtable();
var ht2 = new Hashtable();
var bst = new BSTree();
var g = new Graph(6);
g.addEdge(1,2);
g.addEdge(2,5);
g.addEdge(1,3);
g.addEdge(1,4);
g.addEdge(0,1);
g.vertexList = ["CS1","CS2","Data Structures","Assemble Language","Operation Systems","Algorithms"];
//console.log("The shortest path : " + g.pathTo(4));
g.topSort();
//bst.insert(23);
//bst.insert(45);
//bst.insert(16);
//bst.insert(67);
//bst.insert(2);
//bst.insert(123);
//bst.insert(37);
//bst.insert(3);
//bst.insert(99);
//bst.insert(22);
////bst.remove(23);
//bst.inOrder(bst.root);
//console.log(bst.getMax());
//ht.put("marry","13301028044");
//ht.put("john","13901028044");
//ht2.put("john","13901028044");
////ht.remove("john");
//ht.display();
//
////console.log(ht.get("marry"));
//console.log(ht.size());
//dic.add("Mike","123");
//dic.add("David","345");
//dic.add("John","678");
////console.log(dic.size());
////dic.remove("David");
//dic.add("jake","9909");
////console.log(dic.size());
////dic.clear();
////console.log(dic.size());
//
//dic.showAll();
//console.log("size is : "+dic.size());
//llist.insert("5");
//llist.insert("6","5");
//llist.add("7");
//llist.remove("6");
//llist.add("8");
//llist.add("9");
//llist.display();
//console.log("size is : "+llist.size());
//dlist.add("4");
//dlist.insert("8");
//dlist.remove("4");
//dlist.add("5");
//dlist.insert("6","4");
//
//dlist.dispReverse();
//console.log("size is : "+dlist.size());