subject

The kth quantiles of an n-element set are the − 1 order statistics that divide the sorted set into k equal-sized sets (to within 1). Give an ( log ) time algorithm to list the kth quantiles of a set.
1. If k=1 we return an empty list.
2. If k is even, we find the median, partition around it, solve two similar subproblems of size ⌊n/2⌋ and return their solutions plus the median.
3. If k is odd, we find the ⌊k/2⌋ and ⌈k/2⌉ boundaries and then we reduce to two subproblems, each with size less than n/2. The worst-case recurrence is:
T(n, k) = 2T(⌊n/2⌋,k/2)+O(n)
Which is the desired bound ­ O(nlgk).
This works easily when the number of elements is ak+k−1 for a positive integer a. When they are a different number, some care with rounding needs to be taken in order to avoid creating two segments that differ by more than 1.

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 15:00, lopez7512
What is the total resistance in a circuit that contains three 60 ohm resistors connected in a series? a. 20 ohms b. 120 ohms c. 60 ohms d. 180 ohms
Answers: 2
image
Computers and Technology, 23.06.2019 23:40, lexiecooley
4. what is the reason for including the following code snippet in the header file animal. h? #ifndef animal_h #define animal_h class animal { public: animal(); animal(double new_area_hunt); void birth(); void hunt(double new_area_hunt); void death(); double get_area_hunt() const; private: double area_hunt; }; #endif
Answers: 3
image
Computers and Technology, 24.06.2019 22:00, justincsh7238
Ican’t open these when it’s just a comment. someone pls explain why this is happening
Answers: 1
image
Computers and Technology, 25.06.2019 00:30, jennynmike03
Which of these serves as a bridge between the programming team and the audio team?
Answers: 2
You know the right answer?
The kth quantiles of an n-element set are the − 1 order statistics that divide the sorted set into...

Questions in other subjects:

Konu
Mathematics, 01.09.2020 05:01