Skip to content

Instantly share code, notes, and snippets.

@esys
Created August 19, 2020 20:11
Show Gist options
  • Save esys/1c80adc97c2b49bb7c85fe258e53ef41 to your computer and use it in GitHub Desktop.
Save esys/1c80adc97c2b49bb7c85fe258e53ef41 to your computer and use it in GitHub Desktop.
func main() {
n := NewNode(1)
n.Left = NewNode(2)
n.Right = NewNode(3)
n.Left.Left = NewNode(4)
n.Left.Right = NewNode(5)
n.Right.Left = NewNode(6)
n.Right.Right = NewNode(7)
n.Right.Right.Left = NewNode(8)
start := time.Now()
DFRec(n)
fmt.Printf("took %v\n", time.Now().Sub(start))
start = time.Now()
wg.Add(1)
go DFRecImproved(n)
wg.Wait()
fmt.Printf("took %v\n", time.Now().Sub(start))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment