알고리즘/코드잇
[코드잇] 이분 탐색 구현해보기 파이썬(Python)
츄르사려고 코딩하는집사입니다. def binary_search(element, some_list): low = 0 high = len(some_list) - 1 mid = 0 while low element : high = mid - 1 elif some_list[mid] < element : low = mid + 1 return None print(binary_search(2, [2, 3, 5, 7, 11])) print(binary_search(0, [2, 3, 5, 7, 11])) print(binary_search(5, [2, 3, 5, 7, 11])) print(binary_search(3, [2, 3, 5, 7, 11])) print(binary_search(11, [2, 3, 5, 7, 11..
2021. 10. 12.
최근댓글