tree - Data structure for dealing with intervals -
i've spotted question , couldn't solve it:
[1 ... n^5] interval divided n non-equal non-overlapped intervals. given these intervals , names, can give me data structure can answer these following queries:
input: integer x
output: name of interval x located
input: 2 integers x,y
output: if located in 2 adjacent intervals, union intervals/ new interval holds name of left one.
input: 2 integers x,y
output: if located in same interval [i...j], split three: [i...x-1],[x....y-1],[y....j].
Comments
Post a Comment