Man I really wish you would bring this series back for other algo techniques, you are my fav python instructor on YT
@osvaldogarcia61544 жыл бұрын
Thanks a lot for this videos man, they are so simple, but they explain everything in perfect detail
@MyLoweLife2 жыл бұрын
You explained this like I'm 5 years old and thank you bc it makes perfect sense now 😭🙌🏾
@sechvnnull15242 жыл бұрын
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.
@salvationprayerfellowship88994 жыл бұрын
Thanks alot man for the tutorial very well explained you deserve more subs
@jimrakel4184 жыл бұрын
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!
@in-thegarden2 жыл бұрын
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.
@redachikhaoui12093 жыл бұрын
and also for midpint can be (start + end )//2
@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.
@swarooprajpurohit110 Жыл бұрын
How did your interview go?
@bedi804911 ай бұрын
@@swarooprajpurohit110 bro did not get hired
@solomontaiwoabbaly4 жыл бұрын
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!!😀
@msms32604 жыл бұрын
You are sooooo young and smart. I feel so inadequate in regard to thinking capacity 😭. But your videos are amazing, please don’t stop!
@ahyungrocks55095 ай бұрын
Excellent tutorial. Love the algorithm explanation at the end to re-iterate our understanding.
@murtazahonarpoor42524 жыл бұрын
You are doing a great job man. The videos are short, well explained and very easy to understand. Please keep posting.
@ilyosbekkarshiboyev71342 жыл бұрын
Thanks a lot for this videos man
@elijahlair2 жыл бұрын
Really loved this. Simple and precise. Thanks
@toby7093 жыл бұрын
When I studying this using the below list : sequence_a = [1,2,4,5,6,7,8,9,12,14,16,17,22] list_a = 1 it will return 0 as sequence, which looks a bit strange to me...so I add +1 to it, haha print(binary_search(sequence_a, list_a)+1) Btw, it's a good video! Thanks for teaching me!
@pieters2863 жыл бұрын
yes, the list is zero refrenced in code, thus one needs to add 1 again when printing out to natural world.
@GG-le8bq2 жыл бұрын
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 .
@kockgunner Жыл бұрын
For beginners like me, make sure that the while loop has a
@marioandresheviacavieres1923 Жыл бұрын
Thanks a lot for the series!! I watch it all
@teen_python_go99472 жыл бұрын
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}"
@nonserviam242 жыл бұрын
For anyone wondering. This is a recursive solution. a = [1,2,3,4,5,6] def binarySearch(value, low, high, list): if low 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))
@juliannafotheringham71012 жыл бұрын
Beautiful videos you angel, so clear and simple.Thank you!!!
@UtkarshaB4 жыл бұрын
keep uploading ...Nicely,Thoroughly explained...
@MrSatz994 жыл бұрын
Thanks amazing it was! Please upload video on linear search also!
@raulsanchez47163 жыл бұрын
Super clear explanation! Thank you so much.
@param83782 жыл бұрын
This solution is better than lead code selection
@rajkumar.alagappan4 жыл бұрын
Why we should use the formula midpoint= (start+end-start)/2 instead of (start +end)/2 ?
@CodeWithDerrick4 жыл бұрын
I think your solution would work fine too! I haven't tested so don't hold me too it though, haha. In my head I was just adding half of the remaining positions to the current beginning position to get the midpoint is why I wrote it that way
@rajkumar.alagappan4 жыл бұрын
@@CodeWithDerrick ☺️ thank you
@igorverevkin77094 жыл бұрын
It does work indeed since your begin_index and end_index get new values on every iteration :)
@zisistsatsos25094 жыл бұрын
I think this code is a little simpler: key=a #the_number_you_are_searching first=0 last=len(L)-1 pos=-1 #the_position_of_the_number while first
@hasnainali92952 жыл бұрын
Absolute clutch, as a comp sci student, you explained better than the teacher (no offence to teacher lol)
@ssengendonazil69852 жыл бұрын
i do node.js and php but u made it clear for as weel thanx
@JesusAlfredoHernandezOrozco Жыл бұрын
Great video and explanation!
@defaltcm3 жыл бұрын
Cannot tell if he is smiling or being held at gun point with those facial expressions lol. At times he seems forced other times he generally seems interested.
@CodeWithDerrick3 жыл бұрын
😂😂
@6abriel94 жыл бұрын
Thanks man! excellent explanation, greetings from Argentina
@kelvin6335 Жыл бұрын
Great vid! tysm!
@methulidulanima53442 ай бұрын
Thank you !
@diegososa52803 жыл бұрын
Thank you so much. Huge help. Subscribed
@soseofficial39232 жыл бұрын
very useful brother. thanks a lot.
@zakirhossain74134 жыл бұрын
gracefully done!
@augusto.carmona3 жыл бұрын
great videos man!
@Corrado493 жыл бұрын
thanks, really help me out!
@jpchato3 жыл бұрын
Awesome, Thank you!
@adji973 жыл бұрын
thanks man this video helps alot
@selimtanrverdi96393 жыл бұрын
Thanks a lot. Very great explanation.
@eZaFJDUBB8 ай бұрын
The program as is returns None every time unless you purposely choose a midpoint equal to the value you're searching for
@Sun481003 жыл бұрын
Thanks, this is helpful.
@gedtoon645127 күн бұрын
Your algorithm is not quite right. if sequence_a = [2, 4, 5, 6, 9, 9, 9, 10, 12, 13, 14] and item_a = 9 it will return index 5. It is generally accepted that binary search should find the first occurrence, which is 4. Can you correct this problem?
@BiblicalArchaeologyAR3 жыл бұрын
Thank you!!
@thishuman Жыл бұрын
Thank you :)
@shaharrefaelshoshany94423 жыл бұрын
wowww, super!!
@davlatbekkobiljonov911 Жыл бұрын
thank you
@priyanshudatta8845 Жыл бұрын
you should cast as jack frost. ♥
@josepha84152 жыл бұрын
Great video
@saiyan55925 ай бұрын
Bro pls post more videos on this datas and the algorithms pls ........................ 🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏
@kda_-uh3vj4 жыл бұрын
2:52 hahaha bruh that glitch in your face, sorry but I can't help but laugh but laugh it off. Btw really good video, it helped me a lot ;)
@rebornpixelsproduction3 жыл бұрын
While coders where too busy focusing on the code, you was busy focusing on him yeh :)
@lackyyyy30983 жыл бұрын
@@rebornpixelsproduction u should focus on english yeh :)
@yilu32192 жыл бұрын
why the midpoint is begin_index + ? why just second part ( end -begin)//2 only?
@nikhilparakh32513 жыл бұрын
Amazing!!!
@armisol004 ай бұрын
TY BRO
@vlogiiidawidaaa74083 жыл бұрын
Is there going to be any more videos on algorithms? Great work!
@AreeshaSiddiqui-zy7js3 жыл бұрын
please do a video on data structures and linked list too
@temik262 жыл бұрын
Perfect!
@Adam-gp3ij2 жыл бұрын
Awesome
@demrieanntinds3 жыл бұрын
hello Derrick, I have a question. What if in the sorted list there is a duplicated number/ numbers? Thanks a lot! :)
@bolawolesegun42482 жыл бұрын
it will pick the first index of the located value
@mustafaa.46903 жыл бұрын
Who else feels embarrassed? 🤣🤣 Note: Really thank you for this content. It helped me a lot.
@user-yp2wr9hl7g9 ай бұрын
Derrick ,I just completed a python course ,however it is a basic one i am still finding myself rigid while coding how do they I can develop myself to a level where i can write codes smoothly?? Thanks
@blo0buryz__7453 жыл бұрын
I can't figure out how to use binary search and user input. I want to use binary search to look at a list of names the user typed in , ask the user for a name to search and display if the name was there or not. I doubt you'll see this but I thought I would put it out there. Can anyone help me?
@meteerol80823 жыл бұрын
@Mister Blo0 as he did, user could input the target as an argument in function
@emorgan86985 жыл бұрын
Hey Derrick. Really enjoy your videos and I think is brilliant the animations you are now adding to the beginning of your videos to explain the theory. I'm trying to create a complexity matrix to determine how complex a project is based on user's input. Was thinking on using radio buttons or something similar for the user to select the input and then generate the result based on the selections. Any ideas on how best to accomplish this (it would need to be a web app)? I am new to Python. Do you think Django would work?
@CodeWithDerrick5 жыл бұрын
Hey Eduardo! Thank you for the kind words! Sorry for the slow reply on this one. Django would definitely be able to handle it for you if you wanted to go down that route. You could collect the input using an HTML form, pass that to your view in django, do your calculations within your view, and then return it back to an HTML page. Django does take a bit of set up in the beginning, but once you get it running, there isn't really a limit to what you can do with it. If you decide to go down that route let me know if you get stuck anywhere - happy to make some tutorial videos around website creation!
@emorgan86984 жыл бұрын
@@CodeWithDerrick thanks for your reply. if you could do some videos related to this idea that would be great. I'm not a developer so it can get tricky to get this up and running. I have some experience with RPGIV but I now work as Business Analyst. My idea is quite simple. have a table with rows and columns and allow users to select the options using radio buttons and show the risk level at the end. for both the radio buttons and the risk level I'm planning on using Bootstrap. in the meantime I'll keep trying and see how far I can get. keep up the good work and thanks for the help.
@nupurjhankar6745 Жыл бұрын
can you do merge sort video
@jingzhuang41684 жыл бұрын
Thumbs up!
@LstrnNoob4 жыл бұрын
def search(list,target): for item in list: if list[item]==target: print(i) list=[4,3,6,8,7,9] target=7 search(list,target) 4 #print the index where item belongs
@klejdisbeshi87684 жыл бұрын
I think it should be if item == target... And this is not binary search so your comment is not valid.
@brainworkout70352 жыл бұрын
Is it wrong if I find the mid_point like: midpoint = (begin_index + end_index) // 2
@madushani68442 жыл бұрын
Please upload the vedios for Merge sort, shell sort & heap sort as well.🥺❤️
@udaijitpattnaik42423 жыл бұрын
what do you actually mean by complexity? is it the time required for the p;rogram to run? if we use quick sort could you please how much time will the program take
@pritam13663 жыл бұрын
which ide is used in this video
@loop721010 ай бұрын
program code not working properly.IS the code wrong guys ?
@wajdy2620 Жыл бұрын
im confused by the 7th line. Isnt beginning index always going to equal the same so then it would just cancel out? How could beginning index be 2 different values in the same line?
@shaharyarahmed57773 жыл бұрын
i noticed a issue if you pass [1, 2, 3, 4, 5] as the sequence the while loop goes infinity
@znpkami3 жыл бұрын
neat!
@agesilausii77594 жыл бұрын
Thanks very good Explanation. Why not put middle = (begin + end)//2 ? Looks simpler. :)
@Change_Test4 жыл бұрын
I stumbled on the answer to this in another video. For certain sizes of input arrays, begin+end can create an integer overflow in some programming languages, so adding the extra steps prevents integer overflow errors. I don't understand what that means, but apparently that's the reason for this format.
@agesilausii77594 жыл бұрын
paperfish113 really? Thats interesting. I think overflow is when a number is too big for computer memory to handle.
@lucasm42992 жыл бұрын
@@agesilausii7759 Yes and while (begin + end) may be overflow l, (end-begin) won’t be overflow
@TheGorilla584 жыл бұрын
It's something I was using by 1981 (When I started with CP/M and PDP11 and VAX sistems). What You are showing it'a the startig procedure of a binary search. What about duplicates? It was already used in 1957 (Peterson, William Wesley (1957). "Addressing for random-access storage". IBM Journal of Research and Development.). Finally, I think U studied well. Pls Read also "Moore School Lectures" from the University of Pennsylvania's Moore School It's an old 1946 Compendium. Here is the link en.wikipedia.org/wiki/Moore_School_Lectures
@storm_rising4 жыл бұрын
nrb approves
@elisasee75383 жыл бұрын
Hey for line 7 why can't it just be begin+end//2
@spamcocobutt36722 жыл бұрын
wut if you have an even amount of items
@tonymartin37382 жыл бұрын
How do you perform 1 through 300
@marclim93043 жыл бұрын
my number is off by one position what should i do?
@yunkel5 жыл бұрын
👍
@storm_rising4 жыл бұрын
do you play Minecraft?
@mariobezuidenhoudt66954 жыл бұрын
midpoint = (begin_index + end_index)//2
@tareqmahmud39023 жыл бұрын
Umm, why am I getting TLE's? Time limit expired errors. :)
@shiili76994 жыл бұрын
excuse me, why should "begin" and "end" be assigned to "mid +1" and "mid-1" ? istead of just "mid"
@huzaim.224 жыл бұрын
Beacause of index in position Hence +1 means after the mid and -1 is before the middle point
@rajivgardas29202 жыл бұрын
I love you
@SEE.ME.N0.M0RE3 жыл бұрын
Thank you so much Derrick, I've been rewatching the playlist almost daily. I have a question: I've tested this on an unsorted list and it did find the index of the element I'm searching for, does this mean that this can work on an unsorted list as well? Many thanks!
@fareselamine81152 жыл бұрын
Binary assumes you already have a sorted list. If you know the list to start with is unsorted, run it through a sorting algorithm first.
@Pmills93 жыл бұрын
I don't get what is the point of this? Why not just return the index of the target number? Wouldn't it be the same either way? This just seems like an overly complicated way to do that. Not bashing you or anything but I just don't see the point of all this extra code
@abdulrameez1514 жыл бұрын
Is the code same for visual code for python on windows
@MegaKash7864 жыл бұрын
Abdul Rameez yes
@avalon43523 жыл бұрын
ofc. Visual Code is just an IDE. there is no difference in codes
@rinku42403 жыл бұрын
Hey Derrick Sherrill, your video is amazing. But I would request you to please don't speak so fast during the animation or during the explanation.
@saviaggarwal81353 жыл бұрын
not working in pycharm. Help me!!
@Corrado493 жыл бұрын
check the indentations
@shahzan5254 жыл бұрын
Make video on merge sort...... Really need it.....
@tarzan81104 жыл бұрын
I've tested all of the sites for free points and only GameCrook works.
@stilgarfifrawi71553 жыл бұрын
What does it feel like to be born with plastic surgery?
@agsrf64794 жыл бұрын
If I told you that I am lying to you right now, would I be saying the truth?
@shrutikanikhar79874 жыл бұрын
yes
@boogiegames8755 Жыл бұрын
#tafelpoten die de winkel kottenphark in de schappen heeft Tafelpoten = [30, 50, 70, 80, 85, 90, 100, 120, 150] Tafelpoten.sort() MaatVanKlant = int(input("Welkom bij meubelwinkel khottenphark, wij verkopen hier verschillende maten tafelpoten, wat is de maat tafelpoot die u graag wilt?")) #zorgt ervoor dat er binair gezocht wordt def binair_zoeken(lijst, maat): links = 0 rechts = len(lijst) - 1 while links 0: dichtstbijzijnde_maten.append(Tafelpoten[index-1]) if index < len(Tafelpoten): dichtstbijzijnde_maten.append(Tafelpoten[index]) if len(dichtstbijzijnde_maten) > 1: print(f"helaas is de maat {MaatVanKlant}cm niet beschikbaar. daarentegen zijn de maten {dichtstbijzijnde_maten} wel vergelijkbaar met de maat die u gekozen heeft") elif len(dichtstbijzijnde_maten) == 1: print(f"helaas is de maat {MaatVanKlant}cm niet beschikbaar. daarentegen zijn de maten {dichtstbijzijnde_maten[0]} wel vergelijkbaar met de maat die u gekozen heeft") else: print(f"helaas is de maat {MaatVanKlant}cm niet beschikbaar.")