20. You are given a Python function that is supposed to implement the binary search algorithm to find the index of a target element in a sorted list. However, there is a mistake in the code. Identify the mistake and provide the corrected version of the code.
(A) Change len(arr) to len(arr)-1
(B) Change the condition in the while loop to while left<right
(C) Change left=mid+1 to left=mid
(D) Change right=mid-1 to right=mid
(E) Add a condition to handle the case when the target is not found in the list
答案:登入後查看
統計: A(3), B(0), C(0), D(1), E(0) #3228178
統計: A(3), B(0), C(0), D(1), E(0) #3228178