I have some confusion with regards to AVL trees and the heights of various subtrees.
When initially reading the overview of the algorithms purpose(to keep the tree balanced) I thought it put limits ...

I have made a red-black tree and I think that it is not valid. Could someone please verify?
As far as I know, in red-black tree we also consider the leaf nodes at the NULLS of the visible leaf nodes ...

I have an AVL tree with height h. I understand how to get h $\thickapprox$ 1.440 log N. However, I can't figure out how to calculate the minimum depth of a leaf node from root. I tried constructing a ...

I can't quite figure this out. Say you have a binary tree where the left or right nodes correspond to 0 or 1 and a group of levels form a chain which is the index of the node. So you have 10010 which ...

Let's say we are given array $A$ of size $n$. We need to answer some numbers of queries. For each query we are given index $i$ and integer value $k$, $k \le i$. If we take the first $i$ elements of ...

A family of binary trees is called balanced if for every tree $t$ in the family the height of $t$ is $O( \log n)$.
Given a family of trees such that for every tree $t$ in the family, for every node $...

I am familiar with the concept of path-copying in the context of binary trees to achieve persistent modifications, but I am unsure if the inclusion of parent pointers has any effect on the complexity. ...

Given a list of distinct positive integers, I am trying to find the largest subset that forms an arithmetic sequence with a given difference D.
For example, given D = 5, with the set of numbers 1, 5, ...

I've written a "quiz" that prompts the user for comparisons between two items of subjective value, and once the position of all of the items is determined, displays an ordered list from most valuable ...

My professor asks this question: Binary Search tree has Rotation Method to prevent it from degenerating into a linear structure (unbalanced tree). Why is there no need for such method for Binary Heaps?...

I'm going over past exam papers with this question:
The answer to a). will be (height of 5):
For b.):
I assume the height function will be to find the height of the tree. So, I will have to compare ...

Let $T$ be a complete binary tree of height $n$ and root $r$.
A random walk starts at $r$, and at each step uniformly at random moves on a neighbor.
There are $m$ random walkers all starting at $r$ ...

I couldn't figure this one out. Given an unsorted list, we want to build a balanced binary tree (not a search tree, namely - left child is of lower key, and right child of higher key). Can we do it in ...

We say that a binary tree : $B(l, x, r)$ is increasing if $x$ is smaller than all the nodes of the binary tree and if $l$ and $r$ are also increasing trees.
One way to merge these kind of trees is as ...

I'm having trouble making an algorithm to fit these specs:
Given a complete binary tree ($n = 2^d$ leaves) with integers in leaves.
Reading the leaves from left to right makes a sequence of integers (...

Let's say you want to get the value of all nodes in a binary tree (order doesn't really matter). If in each thread, you spawn two more threads to deal with the left subtree and the right subtree, then ...

For example, consider an AVL tree:
Performing the two_close(T) should give back (13, 12), as they are the closest elements together. Said another way, you can take any two other elements in the tree, ...

I have to determine the Optimal Multiplication Order for above matrices using Dynamic Programming approach and also present that sequence (i.e. optimal order) in Binary Tree.
Consider the following ...

I want to understand Binary Search for 2 element list made of 1,2. I draw a tree as below. Is it correct?
If I want to search for an element 2, it will make 2 comparisons. If I want to search for an ...

I want to design a binary tree with preallocated nodes, in order to avoid calling malloc/free every time I want to insert/delete a node. The problem is I don't know ahead of time how many nodes the ...

If $D(n)$ is the internal path length (sum of the depths of all nodes) for some tree $T$ with $n$ nodes then we have the following recurrence relation: $$D(n)=D(i)+D(n-i-1)+N-1$$ where I simply taken ...

Is preorder traversal enough to check if a tree is subtree of a binary tree?
Are there any scenarios which I can miss if I use just the preorder traversal?
What other methods can be used to check if ...