0

By the definition of a self-balancing BST, the height of the children should = Big-Theta(logn).

How can I check if a BST is self-balancing given the following condition? No. of nodes in its left subtree and right subtree are no more than 90% of the total number of nodes in its subtree (incl. the node itself).

  • 1
    You would need to look at the modification algorithms (insertion/deletion) to prove that a BST is self-balancing. You cannot assert this with confidence by only looking at its current state. So you must prove that *if* the current state is within the 90%-rule (should be easy to check), *then* the algorithms for insertion and deletion will produce a tree that also is within the 90% rule. – trincot Feb 17 '22 at 15:50
  • By the insertion/deletion method do you mean the tree rotation method (to maintain the height property)? If so, does that method actually apply to ALL balanced BST regardless of how much the height of their children differ? –  Feb 17 '22 at 17:03
  • Yes, I mean whatever manipulation is done to keep the tree balanced. It might be called rotation, but there are different algorithms. For instance, in a splay tree it is called splaying. – trincot Feb 17 '22 at 17:14

1 Answers1

1

Yes, if you can ensure that every subtree is at most 90% the size of its parent, then the height of tree can be at most -log(n)/log(.9).

Matt Timmermans
  • 53,709
  • 3
  • 46
  • 87