You explained this like I'm 5 years old and thank you bc it makes perfect sense now ๐ญ๐๐พ
You are amazing! I just started my Data Structures and Algorithms course, and I almost had a heart attack as we covered both linear and binary search algorithms and now have to do math problem for the quiz. Both (0)logn and theta problems. But the most important thing is to understand the logic and what the code is doing. You're doing an awesome job at explaining this!! Thank you.
For anyone wondering. This is a recursive solution. a = [1,2,3,4,5,6] def binarySearch(value, low, high, list): if low <= high: middle = (low+high) // 2 if list[middle] == value: return f"Value {value} is located at Index {middle}" #here we need to check the lower half as the value is smaller than midpoint if list[middle] > value: return binarySearch(value, low, middle-1, list) #here we need to check the upper half as the value is bigger than midpoint elif list[middle] < value: return binarySearch(value,middle+1, high, list) else: return f"Value {value} is not in the list!" print(binarySearch(6, 0, len(a),a))
Thanks a lot for this videos man, they are so simple, but they explain everything in perfect detail
New sub. Best explanation Iโve seen. You actually explain how the beginning and ending points change.
Thank you for your videos. I came across your algorithm series this morning and spent the day watching all 5 videos and learning from your examples. Now I can use them to make my own Python library of tips & tricks to use when I program. Keep up the good work!
You are sooooo young and smart. I feel so inadequate in regard to thinking capacity ๐ญ. But your videos are amazing, please donโt stop!
I'm cramming for my first face-to-face technical interview in 2 weeks and I have to say that I wish I found your channel sooner. Thank you for your effort in making these videos.
Thanks for the tutorials Derrick they are so easy to understand and well explained. Iโm self learning Java and Python for the past three months and your videos are very helpful. Good Teacher.
Thanks alot man for the tutorial very well explained you deserve more subs
Thank you very much for this amazing video. I've been searching everywhere for this but there are too complex. But this one is...Schway!!๐
You are doing a great job man. The videos are short, well explained and very easy to understand. Please keep posting.
Excellent tutorial. Love the algorithm explanation at the end to re-iterate our understanding.
Hey Derrick , this is the first time I came across your video and it is so articulate and lucid . I am already subscribing and looking forward to learn more from you .
Good job Derrick
Binary Search Implementation (I tried before seeing your approach): def binary_search(seq, val): print(f"Base Array: {seq}") seq.sort() print(f"Sorted array: {seq}") midpoint = len(seq)//2 while seq[midpoint] != val: if val > seq[midpoint]: midpoint = midpoint + len(seq[midpoint+1:])//2 elif val < seq[midpoint]: midpoint = len(seq[:midpoint]) return f"value is at {midpoint} index in {seq}"
Really loved this. Simple and precise. Thanks
Absolute clutch, as a comp sci student, you explained better than the teacher (no offence to teacher lol)
Thanks a lot for this videos man
@kiraisonline