-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
132 lines (112 loc) · 3.11 KB
/
main.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
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
// The main code to run all off the packages for this program
package main
import (
"fmt"
"go_algo/binarytrees"
"go_algo/challenges"
"go_algo/llproblems"
"go_algo/queuesstacks"
)
// Use to make a thickLine in the terminal to split up the main categories
func thickLine() {
fmt.Println("==============")
}
// Use to make a thin line in the terminal to split up the code tests
func thinLine() {
fmt.Println("--------------")
}
// Testing out Challenge Problems
func main() {
// Testing out the Challenge problems
thickLine()
fmt.Println("Challenge Problems")
thinLine()
// Testing the RunningSum
challenges.RunningSumTests()
thinLine()
// Testing the MaximumWealth
challenges.MaxWealthTests()
thinLine()
// Testing FizzBuzz
challenges.FizzBuzzTests()
thinLine()
// Testing Number of Steps
challenges.NumberOfStepsTests()
thinLine()
// Testing Middle of the Linked List
challenges.MiddleNodeTests()
thinLine()
// Testing Ransom Note
challenges.CanConstructTests()
// Testing Linked Lists
thickLine()
fmt.Println("Running Linked List Tests")
thickLine()
// Testing reverseList
llproblems.ReverseLLTests()
thinLine()
// Testing removeElements
llproblems.RemoveListNodeTests()
thinLine()
// Testing Palindronme Linked Lists
llproblems.PalindromeLLTests()
thinLine()
// Testing Merge Two Sorted Lists
llproblems.MergeLLTests()
thinLine()
// Testing Two Numbers Linked Lists
llproblems.AddingLLTests()
thickLine()
fmt.Println("Testing out class features")
thickLine()
// Testing out Queue class
var testQ = new(queuesstacks.LinkedQueue)
//fmt.Println("Empty linked queue:")
//var testQStr = testQ.PrintQueue()
//fmt.Printf("%v\n", testQStr)
//fmt.Println("Queue list add in operations:")
testQ.Push(1)
//testQStr = testQ.PrintQueue()
//fmt.Printf("%v\n", testQStr)
testQ.Push(2)
//testQStr = testQ.PrintQueue()
//fmt.Printf("%v\n", testQStr)
//fmt.Println("Queue list removal operation:")
//q_val :=
testQ.Pop()
//fmt.Printf("Removed %v from the queue\n", q_val)
//testQStr = testQ.PrintQueue()
//fmt.Printf("%v\n", testQStr)
thinLine()
// Testing out Stack class
var testS = new(queuesstacks.LinkedStack)
//fmt.Println("Empty linked stack:")
//var testSstr = testS.PrintStack()
//fmt.Printf("%v\n", testSstr)
//fmt.Println("Stack list add in operations:")
testS.Push(1)
//testSstr = testS.PrintStack()
//fmt.Printf("%v\n", testSstr)
testS.Push(2)
//testSstr = testS.PrintStack()
//fmt.Printf("%v\n", testSstr)
//fmt.Println("Stack list removal operation:")
//s_val :=
testS.Pop()
//fmt.Printf("Removed %v from the stack\n", s_val)
//testSstr = testS.PrintStack()
//fmt.Printf("%v\n", testSstr)
thinLine()
// Testing out Binary Tree Package
testBT := new(binarytrees.BinaryTree)
testBT.Push(20)
testBT.Push(10)
testBT.Push(30)
fmt.Printf("New binary tree node with value of %v\n", testBT.Root.Val)
fmt.Printf("Binary Tree left node = %v\n", testBT.Root.Left.Val)
fmt.Printf("Binary Tree right node = %v\n", testBT.Root.Right.Val)
testBST1 := testBT.BST(5)
fmt.Printf("Able to find 5? %v\n", testBST1)
testBST2 := testBT.BST(10)
fmt.Printf("Able to find 10? %v\n", testBST2)
}