Questions tagged [avl-trees]

54 questions
22
votes
1 answer

AVL trees are not weight-balanced?

In a previous question there was a definition of weight balanced trees and a question regarding red-black trees. This question is to ask the same question, but for AVL trees. The question is, given the definition of $\mu$-balanced trees as in the…
10
votes
4 answers

Don't understand one step for AVL tree height log n proof

I came across a proof that an AVL tree has $O(\log n)$ height and there's one step which I do not understand. Let $N_h$ represent the minimum number of nodes that can form an AVL tree of height $h$. Since we're looking for the minimum number of…
4
votes
1 answer

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 Theta in general but am having trouble…
4
votes
2 answers

AVL tree worst case height proof

The worst case height of AVL tree is $1.44 \log n$. How do we prove that? I read somewhere about Fibonacci quicks but did not understand it.
user99043
3
votes
1 answer

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 not an if and only if?.
DaniDin
  • 33
  • 4
3
votes
1 answer

Worst Case for AVL Tree Balancing after Deletion

After deleting a node in an AVL tree, self-balancing (zig-zag rotation or the left-right balancing) maintains O(logn) time that is not guaranteed in other unbalanced trees (like BST). The Balancing operation is said to be O(logn). What is the worst…
3
votes
1 answer

Dynamic data structure that checks all prefix sums of a subsequence are >= 0 and sum is = 0

Lets consider sequences whose elements are $-1,0,1$. Subsequence $A[i...j]$ is $good$ if sum of its elements $=0$. Example: for sequence $1,1,0,-1,-1,1$ subsequence $1,0,-1,-1,1$ is $good$. Subsequence $A[i...j]$ is $supergood$ if it is good and…
TurboGuma
  • 207
  • 1
  • 5
3
votes
1 answer

Structure for getting $| \{ a,b \} \subset S : a+b \le d|$ in O(1)

I am struggling with exercise from the old algorithmic exam: $d$ is const for the whole structure. Propose a structure for which you can do: Init(S) //called only 1 time Insert(x, S):: $ S := S \cup \{x\}$ in O(log(|S|) Delete(x, S):: $ S := S…
TurboGuma
  • 207
  • 1
  • 5
2
votes
1 answer

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 prove this. To start with, I created a formula…
HBH
  • 21
  • 1
2
votes
0 answers

How is red-black tree insertion more effective than avl tree insertion

I'm having trouble understanding why RB tree insertion is called more effective in all sources. It's said that AVL trees require "more rotations" than RB trees, but from what I've learned I can't see it. AVL trees always require one or two…
2
votes
2 answers

Self-balancing BST supporting in-order-sequential multi-insertions / multi-deletions in logn+klogk time?

Given a self-balancing binary search tree of size $n$, I want to perform the following operations: InsertInOrderSequentialBatch an ordered sequence of $k$ values (specialized $k \in \{2, 3, 4\}$ or generalized $k \in N $) which are guaranteed to be…
2
votes
1 answer

What exactly is the difference between a Balanced Binary Search Tree and an AVL tree?

I'm learning some Data Structures and I cannot figure out the difference between the Balanced BST and the AVL Tree. From my understanding, an AVL tree is a balanced tree with the height difference <= 1. But then what about the Balanced Binary Search…
2
votes
1 answer

proof non-empty AVL tree

The vertex of a binary tree is called an single child if it has a father's vertex but does not have a neighbor. The root is not considered an single child. let mark in numOnly a number of vertices in T that hold the attribute "single son ", and…
Eden Gilad
  • 21
  • 2
2
votes
2 answers

Managing an hotel using AVL trees - Data Structures

I have a Data Structure question where I need to manage an hotel, each room has a number between $1-n$ and it can be occupied or not. Available Data structures: AVL* Trees, B-Trees, Arrays, Stacks, Queues, Binary Trees. $O(n)$ Space complexity…
0Interest
  • 223
  • 1
  • 11
2
votes
0 answers

Optimizing AVL Tree operations for sequential data

I'm working on an implementation of a data structure that needs a tree-like data structure for accelerating look-ups. The interesting part about this data structure is that the only operations on the AVL Tree are inserting and removing sequential…
1
2 3 4