Hey,

I need help with finding out if BSTs are height and size balanced, Ive got plenty of books and people telling me different things but i need it to click in my own head! Any ideas or simple ways of doing it?

Thankyas!

Recommended Answers

All 4 Replies

Member Avatar for iamthwee

Hey,

I need help with finding out if BSTs are height and size balanced, Ive got plenty of books and people telling me different things but i need it to click in my own head! Any ideas or simple ways of doing it?

Thankyas!

What do you mean height and size balanced.

apparently, a search tree is size balanced if the numbers of the nodes in the left and right subtrees of every node differ by no more than one. and height balanced (AVL balanced) if the heights of the left and right subtrees of every node differ by no more than one.

Confusing! I was just wondering if anyone had any tips or tricks ;)

apparently, a search tree is size balanced if the numbers of the nodes in the left and right subtrees of every node differ by no more than one. and height balanced (AVL balanced) if the heights of the left and right subtrees of every node differ by no more than one.

Confusing! I was just wondering if anyone had any tips or tricks ;)

Did you try Google? You can find recursive functions to determin height of binary tree. Yo can apply that functions to determine height of left and right subtree. Try and see will it work...

if i were you, id rather go with ipr or avl trees which are more balanced than simple b ones. coding may be more diffucult but if you are able to find a pre written b+ or b#tree class/sstructure, it'll be working faster.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.