Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fastest randomized algorithm #18

Open
make-github-pseudonymous-again opened this issue Mar 5, 2017 · 1 comment
Open

Fastest randomized algorithm #18

make-github-pseudonymous-again opened this issue Mar 5, 2017 · 1 comment
Assignees

Comments

@make-github-pseudonymous-again
Copy link
Member

To select kth item among n.
Sample r = n^a (a is < 1) items at random, sort them. Make each sample item count for n^(1-a) original items. Select the k/n^(1-a)th item in the sample. kth original item is within sqrt(r) sample items to the left and right of that item with high probability. If the interval is on the left, start with comparison on the left bound. If the interval is on the left, start with comparison with the right bound. Compute the items in that interval in < 1.5 comparisons. If interval is too big to sort, restart the algorithm. It will be small with high probability anyway so just sort it and return the (k-l)th item in this set, where l is the number of elements to the left of the left bound.
Might also work with n^a = n/log n.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant