-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfibonacciheap_test.cpp
More file actions
54 lines (47 loc) · 1.66 KB
/
Copy pathfibonacciheap_test.cpp
File metadata and controls
54 lines (47 loc) · 1.66 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
#include<iostream>
#include<fstream>
#include<sstream>
#include"fibonacciheap.h"
using namespace std;
int main(int argc, char const *argv[])
{
cout<<print("Create a file named 'fibonacciheapinit.txt', The numbers on each line of this file are shown a fibonacci heap\nfor create new fibonacci heap Create a file called 'fibonacciheapnew.txt' that has only one line", 2)<< endl;
ifstream infile("fibonacciheapinit.txt");
string line;
vector<FibonacciHeap*> FBHS;
while (getline(infile, line)) {
FBHS.push_back(new FibonacciHeap());
istringstream ss(line);
int num;
while (ss >> num){
FBHS.back()->Fib_Heap_Insert(new Node(num));
}
}
string command;
// FBHS[0]->print_heap();
cout<<"extract min fibo heap 0 ---------------------- "<<endl;
Node* FBHS0MIN = FBHS[0]->Fib_Heap_Extract_Min();
cout<<"FBHS0MIN = "<<FBHS0MIN->key<<endl;
// FBHS[0]->print_heap();
cout<<"extract min fibo heap 0 ---------------------- "<<endl;
FBHS0MIN = FBHS[0]->Fib_Heap_Extract_Min();
cout<<"FBHS0MIN = "<<FBHS0MIN->key<<endl;
// FBHS[0]->print_heap();
cout<<"extract min fibo heap 0 ---------------------- "<<endl;
FBHS0MIN = FBHS[0]->Fib_Heap_Extract_Min();
cout<<"FBHS0MIN = "<<FBHS0MIN->key<<endl;
// FBHS[0]->print_heap();
cout<<print("enter h\n", 2);
while(command != "q"){
cin>>command;
if (command=="h") {}
else if (command=="nf") {}
else if (command=="") {}
else if (command=="") {}
else if (command=="") {}
else if (command=="") {}
else if (command=="") {}
}
infile.close();
return 0;
}