What are the differences between segment trees, interval trees, binary indexed trees and range trees?
By : Akhil Vyshakh M T
Date : March 29 2020, 07:55 AM
this one helps. All these data structures are used for solving different problems: Segment tree stores intervals, and optimized for "which of these intervals contains a given point" queries. Interval tree stores intervals as well, but optimized for "which of these intervals overlap with a given interval" queries. It can also be used for point queries  similar to segment tree. Range tree stores points, and optimized for "which points fall within a given interval" queries. Binary indexed tree stores itemscount per index, and optimized for "how many items are there between index m and n" queries.

"Rotation of Binary Search Trees" in Scheme
By : Javidi M
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further You really need to provide more information, such as what is your representation of a 'tree' and how is a tree missing its 'left' or 'right' child defined and handled. code :
(define (maketree value left right)
`(TREE ,value ,left ,right))
(define value cadr)
(define right caddr)
(define left cadddr)
;; How is an 'empty' tree denoted?
(define empty 'EMPTY)
(define (isempty? tree)
(eq? tree empty))
(define (makeleaf value)
(maketree value empty empty))
;; Now you have the basis for a solution; here is a start.
(define (rightrotate tree)
(if (isempty? tree)
empty
(let ((l (left tree)))
(if (isempty? l)
<something>
(maketree (value l)
(left l)
(maketree (value tree) (right l) (right tree)))))))

Given a number n, how many balanced binary trees (not binary search trees) are there?
By : Raven
Date : March 29 2020, 07:55 AM
wish of those help Well the difference will be made only by the last level, hence you can just find how many nodes should be left for that one, and just consider all possible combinations. Having n nodes you know that the height should be floor(log(n)) hence the same tree at depth k = floor(log(n))  1 is fully balanced, hence you know that is needs (m = sum(i=0..k)2^i) nodes, hence nm nodes are left for the last level. Some definition of a balanced binary tree force "all the nodes to be left aligned", in this case it is obvious that there can be only one possibility, without this constraint you have combinations of 2^floor(log(n)) chooses nm, because you have to pick which of the 2^floor(log(n)) possible slots you will assign with nodes, forcing a total of nm nodes to be assigned. For the height story you consider a sum of combinations of 2^floor(log(n)) chooses i as i goes from 1 to 2^floor(log(n)). You consider all possibilities of having either 1 node at the last level, then 2 and so on, until you don't make it a fully balanced binary tree, hence having all 2^floor(log(n)) slots assigned.

Java Binary Trees: Finding the node that reaches two nodes with shortest distance
By : prakashjp.me
Date : March 29 2020, 07:55 AM
like below fixes the issue Change your recursion to return when it checks the left and right children: if (left.reachesBoth(a, b) != null) return left.reachesBoth(a, b);

Minimum and maximum height of binary search trees, 234 trees and B trees
By : user3874833
Date : March 29 2020, 07:55 AM
will help you Minimal and Maximal height of a 24 tree For maximal height of a 24 tree, we will be having one key per node, hence it will behave like a Binary Search Tree.

