Skip to content

Instantly share code, notes, and snippets.

@ajtulloch
Created November 3, 2013 18:43
Show Gist options
  • Save ajtulloch/7293383 to your computer and use it in GitHub Desktop.
Save ajtulloch/7293383 to your computer and use it in GitHub Desktop.
// Recur down the left and right branches in parallel
w := sync.WaitGroup{}
recur := func(child **pb.TreeNode, e Examples) {
w.Add(1)
go func() {
*child = c.generateTree(e, currentLevel+1)
w.Done()
}()
}
recur(&tree.Left, examples[bestSplit.index:])
recur(&tree.Right, examples[:bestSplit.index])
w.Wait()
return tree
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment