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:

  1. input: integer x

    output: name of interval x located

  2. input: 2 integers x,y

    output: if located in 2 adjacent intervals, union intervals/ new interval holds name of left one.

  3. input: 2 integers x,y

    output: if located in same interval [i...j], split three: [i...x-1],[x....y-1],[y....j].


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -