We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0a34cf7 commit 6f847d5Copy full SHA for 6f847d5
binarytree.go
@@ -485,6 +485,11 @@ func (n *Node[T]) IsCompleteTree() bool {
485
return true
486
}
487
488
+// IsPerfectTree returns true, if the binary tree is full and complete
489
+func (n *Node[T]) IsPerfectTree() bool {
490
+ return n.IsFullTree() && n.IsCompleteTree()
491
+}
492
+
493
// AddAttribute associates an attribute with the node, which will be
494
// used when generating the Dot representation of the tree.
495
func (n *Node[T]) AddAttribute(name, value string) {
0 commit comments