NhacVibe
Ảnh bìa Binary Search: Background & Python Code

Binary Search: Background & Python Code

Brian Faure · 19,8 N lượt xem · 1 thg 10, 2017

Mô tả

Code below... Continuing our series investigating algorithms in Python, in this video we'll cover the Binary Search, a highly efficient searching technique that only applies under certain conditions. In the beginning of the video we'll go over the basics of the binary search, and later we'll open up our coding editor and actually implement the algorithm using Python.

► Python 2 https://github.com/bfaure/Python_Algo...
► Python 3 https://github.com/bfaure/Python_Algo...

► Python Data Structures:    • Python Data Structures #1: Dictionary Object  

► Video series covering GUI development in Python (WIP):    • Python GUI Development #1 - First Steps  

References:

[1] https://en.wikipedia.org/wiki/Binary_...
[2] https://en.wikipedia.org/wiki/Search_...
[3] https://en.wikipedia.org/wiki/Linear_...

In computer science, binary search, also known as half-interval search, logarithmic search, or binary chop, is a search algorithm that finds the position of a target value within a sorted array. Binary search compares the target value to the middle element of the array; if they are unequal, the half in which the target cannot lie is eliminated and the search continues on the remaining half until it is successful. If the search ends with the remaining half being empty, the target is not in the array.
Binary search runs in at worst logarithmic time, making O(log n) comparisons, where n is the number of elements in the array, the O is Big O notation, and log is the logarithm. Binary s