Ask Question
19 October, 11:46

Suppose that an algorithm uses only comparisons to find the i th smallest element in a set of n elements. Show that it can also find the i 1 smaller elements and the n i larger elements without performing any additional comparisons

+1
Answers (1)
  1. 19 October, 14:30
    0
    If the given algorithm employs m comparisons to determine 'x' that is the ith smallest element in a given sample of n elements. By tracing the m comparisons in the given log, the i - 1 smaller elements can be determined by the theory of transitivity. Furthermore, If x > a and a > b, then x > b can be estimated without actually conducting a comparison between x and b. Similarly, the n - i larger elements can be found, too. It is uncertain that there is a possibility of x greater than a certain number or not by the comparison in the given log. It is not possible. Otherwise, the algorithm does not work correctly.

    Explanation:

    If the given algorithm employs m comparisons to determine 'x' that is the ith smallest element in a given sample of n elements. By tracing the m comparisons in the given log, the i - 1 smaller elements can be determined by the theory of transitivity. It is uncertain that there is a possibility of x greater than a certain number or not by the comparison in the given log.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Suppose that an algorithm uses only comparisons to find the i th smallest element in a set of n elements. Show that it can also find the i ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers