@kiraisonline

Man I really wish you would bring this series back for other algo techniques, you are my fav python instructor on YT

@MyLoweLife

You explained this like I'm 5 years old and thank you bc it makes perfect sense now ๐Ÿ˜ญ๐Ÿ™Œ๐Ÿพ

@sechvnnull1524

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.

@nonserviam24

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))

@osvaldogarcia6154

Thanks a lot for this videos man, they are so simple, but they explain everything in perfect detail

@DevoutJourney

New sub. Best explanation Iโ€™ve seen. You actually explain how the beginning and ending points change.

@jimrakel418

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!

@msms3260

You are sooooo young and smart. I feel so inadequate in regard to thinking capacity ๐Ÿ˜ญ.  But your videos are amazing, please donโ€™t stop!

@hb5165

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.

@in-thegarden

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.

@salvationprayerfellowship8899

Thanks alot man for the tutorial very well explained you deserve more subs

@solomontaiwoabbaly

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!!๐Ÿ˜€

@murtazahonarpoor4252

You are doing a great job man. The videos are short, well explained and very easy to understand. Please keep posting.

@ahyungrocks5509

Excellent tutorial. Love the algorithm explanation at the end to re-iterate our understanding.

@GG-le8bq

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 .

@donharrold1375

Good job Derrick

@teen_python_go9947

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}"

@elijahlair

Really loved this. Simple and precise. Thanks

@hasnainali9295

Absolute clutch, as a comp sci student, you explained better than the teacher (no offence to teacher lol)

@ilyosbekkarshiboyev7134

Thanks a lot for this videos man