阿摩線上測驗 登入

試題詳解

試卷:113年 - 113 學士後醫學系招生考試試題:計算機概論與程式設計#119574 | 科目:研究所、轉學考(插大)、學士後-計算機概論

試卷資訊

試卷名稱:113年 - 113 學士後醫學系招生考試試題:計算機概論與程式設計#119574

年份:113年

科目:研究所、轉學考(插大)、學士後-計算機概論

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

正確答案:登入後查看

詳解 (共 1 筆)

推薦的詳解#6967369
未解鎖
1. 題目解析 題目要求我們找出一段實...
(共 1115 字,隱藏中)
前往觀看
0
0