Working on 1-d coordinate.

Revision en1, by stould, 2016-04-12 21:11:14

Hello community. I'll show the following statement:

Given N segments [Li, Ri], 0 ≤ Li, Ri ≤ N ≤ 109, and Q queries Xi. Each query will ask if the Xi is inside some segment.

I have solved this problem sorting the segments, sorting the queries, and finally T(N+Q) processing. I am thinking now, if is it possible to be solved faster?.. But nothing comes to me.

Do you know something faster ?

Tags sorting, binary search tree

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English stould 2016-04-12 22:00:11 124
en1 English stould 2016-04-12 21:11:14 440 Initial revision (published)