Skip to content

PRO TIP Block youtube.com at the DNS level — Pi-hole, NextDNS or your hosts file — but allow youtube-nocookie.com and i.ytimg.com. These tutorials keep playing; the rabbit hole does not.

Learning without distractions

Binary Search – Data Structures & Algorithms Tutorial Python #13

97.3K views on YouTube

Binary search is a popular search algorithm that can find an element using log(n) time complexity. In this video we will go over theory behind binary search, compare it with linear search and then implement binary search in python.

Code: https://github.com/codebasics/data-structures-algorithms-python/tree/master/algorithms/1_BinarySearch/binarysearch.py
Exercise: https://github.com/codebasics/data-structures-algorithms-python/tree/master/algorithms/1_BinarySearch/binary_search_exercise.md

Topics

00:00 Overview
00:22 Theory behind linear search
02:23 Theory behind binary search
05:50 Python code for binary search
15:40 Performance comparison (linear vs binary search)
18:30 Recursive binary search
23:47 Exercise

Do you want to learn technology from me? Check https://resources.codebasics.io/rxX5h4 for my affordable video courses.

#binarysearch #datastructures #algorithms #python

Next Video: https://www.youtube.com/watch?v=ppmIOUIz4uI&list=PLeo1K3hjS3uu_n_a__MI_KktGTLYopZ12&index=14
Previous video: https://www.youtube.com/watch?v=j0IYCyBdzfA&list=PLeo1K3hjS3uu_n_a__MI_KktGTLYopZ12&index=12
Complete playlist:https://www.youtube.com/playlist?list=PLeo1K3hjS3uu_n_a__MI_KktGTLYopZ12

Website: https://resources.codebasics.io/rxX5h4
Facebook: https://www.facebook.com/codebasicshub
Twitter: https://twitter.com/codebasicshub

DISCLAIMER: All opinions expressed in this video are of my own and not that of my employers’.