Skip to main content
. 2019 Mar 25;9:5059. doi: 10.1038/s41598-019-41451-3

Table 2.

The algorithm to build range tree with fractional cascading. Input P is the original interval set. Return the root node v of the resulting range tree.

Algorithm BuildRTFC(P)
1. Sort P by y-value, return an array of intervals Py.
2. if P contains only one interval i then
3.     Creating a leaf node vleaf storing this interval. i.e., vleaf. interval = i
4. else
5.     Split P into Pleft and Pright, the subsets ≤ and > the median x-value xmid of P.
6.     Sort Pleft and Pright by y-value.
7.     Create an FC-index Ileft from Py to Pleft.
8.     Create an FC-index Iright from Py to Pright
9.     vleft ← BuildRTFC(Pleft)
10.     vright ← BuildRTFC(Pright)
11.     Create a node v storing xmid, Ileft and Iright. v.x = xmid; v. data = Py;         v. lfc = Ileft; v. rfc = Iright; v. lchild = vleft; v. rchild = vright
12. end if
13. return v