Questions tagged [avl-trees]
The avl-trees tag has no summary.
54 questions
3 votes
1 answer
741 views
Binary search tree with height of max 1.44 * log(n) is AVL tree or it's not an iff
Assume I have a binary search tree, and I managed to prove that its height is upper bounded by $1.44 \log(n)$. Now, can I say with confidence that it is, for sure, an AVL tree? or is this condition ...
2 votes
1 answer
207 views
Possible values of root of AVL tree
I have a question: given that an AVL tree holds numbers 1, 2, 3, ..., 1000, what are the smallest and largest possible values of the root? I have a feeling it is 500 and 501, but I don't know how to ...
0 votes
0 answers
98 views
Sub-Grouping AVL tree based on nodes amount in O(log(n))
I need to find a way to split an AVL tree based on the amount of nodes in the tree, lets assume you get a number $k$ and if the number of nodes in the tree is multiplication of $k$ you need to find ...
0 votes
1 answer
114 views
Time Complexity: Determining if a binary tree is balanced
I found an algorithm for determining if a binary tree is height-balanced. It Gets the height of left and right subtrees using dfs traversal. Return true if the difference between heights is not more ...
0 votes
2 answers
145 views
AVL tree with balance factor equal to depth
If you were to define an altered AVL tree where the balance factor (the difference between the height of the left and right subtree) of a node must be less than or equal to the depth of the node (in ...
1 vote
2 answers
472 views
Ordered sequence with logarithmic insert and remove
Problem: we have a sequence of numeric values, e.g. [102, 25, 77, 17, 2, 13]. We need to implement 3 operations, each can be at most logarithmic time complexity. <...
0 votes
0 answers
659 views
Number of ways to insert elements into an AVL tree such that there are no rotations
How many ways can we insert elements { 1, 2, 3, .... 7 } to make an AVL tree so that it does not have any rotation? I broke it down into 2 cases: Case 1: height of tree = 2, (a complete binary tree) ...
0 votes
1 answer
97 views
What does h indicate in this diagram of avl trees?
Looking at the tree on the left it seems that the triangles represent leaves of the avl tree. To arrive at the balancing of -2 besides the node y the right subtree must have 2 nodes while the left ...
1 vote
1 answer
131 views
Find a key in a BBST for which sum of values of keys smaller then it - is maximal
I'm required to describe an implementation of a data structure that holds key,value pairs, which can be signed integers. We need to be able to init() in O(1), insert(x) in O(logn), delete(x) in O(logn)...
1 vote
1 answer
304 views
logarithmic height AVL trees
AVL trees are height balanced binary search trees. As a consequence of this balance, the height of an AVL tree is logaritmic in its number of nodes. Then, searching and updating AVL-trees can be ...
4 votes
1 answer
907 views
Big O vs. Big Theta for AVL tree operations
On the Wikipedia page for AVL trees, the time/space complexity for common operations is stated both for average case (in Big Theta) and worst case (in Big O) scenarios. I understand both Big O and Big ...
1 vote
1 answer
342 views
Interval Tree by Augmenting an AVL Tree
According to Wikipedia: An augmented tree can be built from a simple ordered tree, for example a binary search tree or self-balancing binary search tree, ordered by the 'low' values of the intervals. ...
0 votes
1 answer
601 views
Height of AVL Tree
I found an AVL tree implementation on the internet and experimented: For a tree with node count of 2^20, the minimal and maximal tree heights are 16 and 24. While these heights are lg(n)-ish, I am ...
0 votes
1 answer
463 views
AVL Tree rotations
What size is the largest AVL tree for which an insertion could trigger a double rotation?
-1 votes
1 answer
126 views
Are AVL&RB Trees without additional storage for balance information in each node feasible?
One advantage claimed for scapegoat trees over other balanced trees like AVL or red-black(RB trees - just mentioning AVL henceforth) is not needing to store additional balance information. But can't ...