Question: 2. (33.33 points) Input is sequence X = k1, k2, ... , kn of real numbers not necessary in sorted order. It is known that

2. (33.33 points) Input is sequence X = k1, k2, ... , kn of real numbers not necessary in sorted order. It is known that each element of X is in one of the following disjoint intervals: [a, b], [a2, b2], ... , [aq, bq] The problem is to compute ni, N2, ..., ng, where ni is the number of elements of X in the interval (ai, bi], 1 sisq. Present an algorithm for solving this problem that takes O(n log q) time. The intervals are given and they need not be in sorted order. Also, assume that a
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
