-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfhmain.go
53 lines (49 loc) · 811 Bytes
/
fhmain.go
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
package main
import S "github.com/Sreevani871/fibheap"
import "fmt"
func main() {
node := S.NewHeap()
fmt.Println("Choose Operation\n\n1)Insert\n2)ExtractMin\n3)GetMinimumValue\n4)Merge\n5)Print\n")
var op int
fmt.Scanf("%d", &op)
for true {
switch op {
case 1:
{
fmt.Println("Enter an element to insert:")
var e float64
fmt.Scanf("%f", &e)
node.Insert(e)
}
case 2:
{
fmt.Println(node.ExtractMin())
}
case 3:
{
fmt.Println(node.GetMinValue())
}
case 4:
{
node1 := S.NewHeap()
node1.Insert(10.0)
node1.Insert(20.0)
node1.Insert(5)
node.Merge(node1)
}
case 5:
{
node.String()
node.PrintTrees()
}
default:
{
}
}
fmt.Println("choose operation")
fmt.Scanf("%d", &op)
if op > 5 {
break
}
}
}