-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
81 lines (54 loc) · 1.28 KB
/
main.cpp
File metadata and controls
81 lines (54 loc) · 1.28 KB
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
#include <iostream>
#include "tree/RbTree.h"
#include "tree/Heap.h"
#include "sorting/Quicksort.h"
#include "graph/Graph.h"
#include "graph/GraphSearch.h"
using namespace std;
void rbTree(int * data) {
RbTree rbTree1;
auto quicksort = new Quicksort();
quicksort->quickSort(data,0, sizeof(data)/sizeof(data[0]) -1);
std::cout << "\n\n\n" << std::endl;
rbTree1.deleteValue(7);
rbTree1.inorder();
rbTree1.printTree();
}
void minHeap() {
Heap h(11);
h.insertKey(3);
h.insertKey(2);
// 3이 제거됨
h.deleteKey(1);
cout << h.getMin() << " ";
h.insertKey(15);
h.insertKey(5);
h.insertKey(4);
h.insertKey(45);
cout << h.extractMin() << " ";
cout << h.getMin() << " ";
h.decreaseKey(2, 1);
cout << h.getMin();
}
void bfs(Graph &g) {
cout << "Following is Breadth First Traversal "
<< "(starting from vertex 2) \n";
GraphSearch::bfs(&g, 2);
}
void dfs(Graph &g) {
cout << "Following is Depth First Traversal "
<< "(starting from vertex 2) \n";
GraphSearch::dfs(&g, 2);
}
int main(void) {
Graph g(4);
g.addEdge(0, 1);
g.addEdge(0,2);
g.addEdge(1,2);
g.addEdge(2, 0);
g.addEdge(2, 3);
g.addEdge(3, 3);
bfs(g);
dfs(g);
return 0;
}