Trees in Go: basic properties and computation

This is the second post in the series “Trees in Go”, where we explore the tree data structure and algorithms in the Go language. In the previous post, we introduced binary trees and showed their representation in Go, and how to instantiate them. In this post, we will introduce elementary properties of trees, and show how to compute them with simple algorithms.

Tree size: the number of nodes in the tree

There are many ways to define tree size. One way to define it is to say they are the number of…