private void constructTrapezoids(int nseg) { // Add the first segment and get the query structure and trapezoid // list initialised int root = initQueryStructure(chooseSegment()); for(int i = 1; i <= nseg; i++) segments[i].root0 = segments[i].root1 = root; int ls_n = logStarN(nseg); for(int h = 1; h <= ls_n; h++) { for(int i = nRatio(nseg, h - 1) + 1; i <= nRatio(nseg, h); i++) addSegment(chooseSegment()); /* Find a new root for each of the segment endpoints */ for(int i = 1; i <= nseg; i++) findNewRoots(i); } for(int i = nRatio(nseg, ls_n) + 1; i <= nseg; i++) addSegment(chooseSegment()); }