5 questions
2
votes
1
answer
72
views
Is there a way to build a balanced BST from sorted array so that the duplicates are only in right subtree?
I need a function that takes as an argument pointer to sorted array and returns pointer to a balanced BST. My assumption is that for each node all nodes in left subtree are smaller and all nodes in ...
0
votes
0
answers
68
views
How to construct an AVL tree from a set of keys: 10, 20, 5, 4, 3, 2, 30, 40?
I'm trying to understand how an AVL tree is built from a sequence of integer keys. The keys I have are:
10, 20, 5, 4, 3, 2, 30, 40
I want to construct the AVL tree step by step and see how rotations ...
0
votes
1
answer
101
views
Performing a rotation on an avl tree
Does anyone know how to perform the right left rotation on this avl tree?
I moved 45 up to be the root, the 50 to be the right child, and the 40 to be the left child but where do the children of 45 ...
0
votes
1
answer
58
views
How many binary search trees can be made with 36 nodes that the difference between depth of the leaves is at most 1?
I am looking at this challenge:
How many binary search trees can be made with 36 nodes such that the difference between the depths of the leaves is at most one?
Can I say that it also means that How ...
2
votes
3
answers
1k
views
How to rebalance BST if removing root node
Let's say I delete the root node (6), how do I rebalance the tree?
Is rebalancing the tree related to a left or right rotation? Would it be different depending on AVL vs Red/Black?