AdventOfCode2021/day18/18a/main.go
Luke Else 5bd95a716f day 18a incomplete
was unable to complete the challenge today

Ideally, I would like to wait for generics to release in Go version 1.18 (February 2022)

decided to spend the time working on an implementation of a Binary Search Tree that makes use of the string that is currently stored in the Node Item
2021-12-18 22:09:37 +00:00

56 lines
1.1 KiB
Go

package main
import (
"AdventOfCode2021/shared"
)
func main() {
//content := returnContent("../input")
//content := returnContent("../testInput")
list := []int{5, 1, 3, 5, 4, 6, 2, 7, 9, 8, 0}
tree := shared.BinaryTree{}
for _, v := range list {
tree.Insert(v)
}
tree.InOrder(tree.Head)
//Had no Idea where to even start with this challenge
//Ideally wanted to use a binary tree
//will be looking to make use of generics when they release in Go verison 1.18
}
// func returnContent(path string) *[]int {
// //read file and return it as an array of integers
// file, err := os.Open(path)
// var content []int
// if err != nil {
// fmt.Println("Unlucky, the file didn't open")
// return &content
// }
// defer file.Close()
// scanner := bufio.NewScanner(file)
// regex, _ := regexp.Compile(`[-+]?[\d]+`)
// strings := []string{}
// for scanner.Scan() {
// strings = regex.FindAllString(scanner.Text(), 4)
// }
// for _, val := range strings {
// num, _ := strconv.Atoi(val)
// content = append(content, num)
// }
// return &content
// }