The list of N integers is not sorted.
The solution is asked for a particular query.

@Abhijit Reddy: Can you elaborate more on* Binary Indexed Trees* or *Segment
Interval trees*. May be you opted for the correct data structure. Please
give the algorithm.

@All: Doing a sorting for O(n logn) and then binary search for x1 and x2 in
O(logn) will be less efficient than the simple solution of O(n). Think on
the data structure that can optimize it.
Is it possible in time complexity < O(n)?

>
>


-- 
Thanks & Regards,
Priyanka Chatterjee
Third Year Undergraduate Student,
Computer Science & Engineering,
National Institute Of Technology,Durgapur
India
http://priyanka-nit.blogspot.com/

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to