data structure tree complexity -
i have tree
i sure max heap, , don't know if full tree because in course notes says binary tree full tree when every non-leave node have 2 children.
max-heap. there have example, , yes, tree max-heap.
also, full tree, each level has filled nodes, in this example. tree complete tree, not full tree. hope helps.
to binary search tree, has respect rules. example, have root, left , right child.
2 1 3 the left tree (made 1 single node here) has have lower values root, , right tree (here made 1 single node) has have values greater root. no, tree not binary search tree.
regarding second question (you should post 1 question / post)... worst case o(n) if tree not binary search tree. if binary search tree, o(log n) in worst case, if have balanced tree!.
if have binary tree, worst case o(n) because of valid binary search tree.
a balanced binary search tree optimized different kind of operations. in general tree, depending how built, worst cases o(n)!

Comments
Post a Comment