Which of the following statements is true of the worst-case performance of unord
ID: 3737979 • Letter: W
Question
Which of the following statements is true of the worst-case performance of unordered linear search, ordered linear search, and binary search on large arrays?
A : The worst case for all three of these algorithms is the same.
B : Unordered linear search is the worst, ordered linear search is the next best, and binary search is the best.
C : The worst-case behaviors of unordered linear search and ordered linear search are identical, but binary search has better worst-case performance than either of them.
D : The worst-case performance of unordered search depends on the exact order of the array - it could be either the best of the three or the worst.
Explanation / Answer
ans is c
since in linear search whether for unordered elements or ordered elements we need to pick each single and element and then we need to compare it the element we need to find so the worst case or the time compexity for both the unordered list and ordered list is same but binary search will have better worst case performance since in binary search element we find the middle element of the array and then search with the element to find if it is the same element we return the index if the element to find is greater the middle element then we search in the right part of the element else on the left part of the array
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.