Created
May 16, 2019 21:57
-
-
Save Mintri1199/69b75f3a34c0ea844e9ec7f917b28137 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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