In the context of data structures, tree balancing refers to reorganizing the nodes in a binary search tree to ensure that the height of the tree is not too large.
Questions tagged [tree-balancing]
79 questions
-1
votes
2 answers
How can I fix my array so I don't have an IndexOutOfBoundsException?
For a HW assignment, I was tasked to add a bunch of methods into a BinarySearchTree class. Two methods I have are balance and InsertTree (I think it should've been named InsertNode). The authors from the textbook provided pseudo code of what the…

GGz
- 3
- 5
-1
votes
1 answer
How would I balance a degenerate tree? C++ Data Structure
I am currently learning data structure using C++.
I understand how you would balance binary search tree as you insert new nodes.
However, what if you already have a degenerate tree(single linklist), and want to balance that without creating a new…

jvsper
- 41
- 4
-1
votes
2 answers
What are the two subtrees for C that makes it unbalanced?
In the tree:
A
/ \
B C <-- Difference = 2
/ /
D E
/
G
What are the two subtrees for node C that make it unbalanced??

Leslie Liang
- 23
- 3
- 7
-1
votes
1 answer
C: Creating a AVL balanced Tree
I'm trying to write a code to create a AVL balanced binary tree.
The purpose is that the subtree shall be rotate to keep the (AVL) balance each time a new node is inserted.
(All values in the left subtree of a node must be smaller than this node…

Kaiser
- 35
- 1
- 3
- 9