Skip to main content

Questions tagged [binary-search-trees]

0 votes
0 answers
37 views

I'm exploring data structures suitable for persistent applications. A key use case I have is splitting a subsegment from a tree, copying it, and then merging these copies into other data structures. ​...
吴松原's user avatar
0 votes
1 answer
58 views

by "augmentation" i mean adding an additional field to each node. All sources i found say something that falls into one of two categories: "A field f in a red-black tree can be ...
MathCat's user avatar
1 vote
1 answer
116 views

I know there's another question asking the same in this website, but answers to that question was not clear; it did not help me. In this wikipedia page, the 2nd property says "All NIL nodes are ...
Cinverse's user avatar
  • 113
2 votes
2 answers
123 views

When I'm faced with a simple tree like the one in the picture, it's very easy to decide whether to do a single rotation or a double rotation. However when the tree is very crowded, like this picture, ...
Manar's user avatar
  • 165
3 votes
1 answer
741 views

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 ...
DaniDin's user avatar
  • 33
-1 votes
1 answer
67 views

My teacher showed me the following slide on the PowerPoint with two binary search trees and their corresponding "average search times". The PPT did not mention what formula was used to ...
Felix An's user avatar
  • 119
0 votes
0 answers
132 views

Consider a sorted list of $n$ elements $x_1, \ldots, x_n$. Using binary search to find $x_k$ in this list takes $f(n, k)$ iterations, where $f : \mathbb{N}^2 \to \mathbb{N}$ is a function such that, ...
Electro's user avatar
  • 103
0 votes
1 answer
101 views

I was given this Binary Search Tree. The question asks whether this tree can ever be optimal with $2.1$ expected comparisons, and I am completely lost on how to even approach this problem. Trying to ...
John36's user avatar
  • 1
2 votes
2 answers
239 views

Take numbers from 1 to 100. Put all of them in a binary search tree. Now, one of those 100 numbers is picked uniformly at random and given to us. We'd like to find it in the binary search tree. The ...
Rohit Pandey's user avatar
0 votes
2 answers
199 views

Let $H(n)$ be the average height of a BST with nodes from ${1,...,n}$. I think that $$H(n) = \frac{1}{n}\sum_{i = 0}^{n-1}\left[\text{max}(H(i), H(n-1 -i)) + 1\right]$$ But I don't know how to prove ...
user167064's user avatar
0 votes
1 answer
114 views

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 ...
Ali Naseri's user avatar
1 vote
1 answer
214 views

An in-order traversal of a binary search tree (BST) produces a sorted sequence. I wonder, if we perform an in-order traversal of a binary tree and obtain a sorted sequence, does that imply that the ...
Mason Rashford's user avatar
0 votes
0 answers
54 views

How to create a structure which acts as union of ranges. In that structure new ranges can be inserted beforehand and then some queries are asked to find out if the given point is covered by any of the ...
user166204's user avatar
0 votes
1 answer
92 views

I'm trying to check if the binary tree is binary search tree. My idea is to use Morris traversal. Intuitively a binary tree is balanced iff Morris traversal produces a sorted threaded linked list. The ...
Some Name's user avatar
  • 105
0 votes
1 answer
98 views

The following theorem was proven by R.E. Tarjan in 1984: Theorem (Sequential Access Theorem). If we access each of the nodes of an arbitrary initial tree once, in symmetric order, the total time ...
Proper Illumination's user avatar

15 30 50 per page
1
2 3 4 5
12