1. 학습
  2. /
  3. 강의
  4. /
  5. Data Structures and Algorithms in Python

Connected

연습 문제

Implementing binary search

In this video, you learned how to implement linear search and binary search and saw the differences between them.

In this exercise, you need to implement the binary_search() function. Can you do it?

지침

100 XP
  • Check whether the search value equals the value in the middle.
  • Check whether the search value is smaller than the value in the middle
  • Set last to the value of middle minus one.