Skip to content

Instantly share code, notes, and snippets.

@Mintri1199
Created May 16, 2019 21:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mintri1199/69b75f3a34c0ea844e9ec7f917b28137 to your computer and use it in GitHub Desktop.
Save Mintri1199/69b75f3a34c0ea844e9ec7f917b28137 to your computer and use it in GitHub Desktop.
class DecimalSearchTree{
let root: DecimalTreeNode = DecimalTreeNode(data: "+")
var size: Int = 11 // number of nodes in the tree and the unuse node
var usedSize: Int = 0 // Number of nodes that are used
func isEmpty() -> Bool{
// Return true if this decimal search tree is empty (has no nodes)
return self.root.isLeaf()
}
func height() -> Int{
// Return the height of this tree (the number of edges on the longest
// downward path from this tree's root node to a descendant leaf node).
return self.root.height()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment