Probabilistic selection algorithm -


given is:

  • an array of length n.
  • the array contains integers.
  • the integers not sorted.

find algorithm that:

  • returns (a close approximation of)the k-th smallest array element.
  • has runtime complexity of o(n log n) , space complexity of o(log n).
  • the algorithm needn't deterministic. in case of probabilistic algorithm provide measure quality of approximated result.

treat problem analogous quicksort. given element in array, can rank in o(n) time , o(lg n) space. can use binary search find element given rank in o(lg n) iterations of that, total of o(lg n) space , o(n lg n) time.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -