An implementation of the binary search algorithm in C. Source code: github.com/por.... Check out www.portfolioc... to build a portfolio that will impress employers!
I love your videos. I have a midterm tomorrow on uni course C programming and I have been watching many videos about this topic and nobody can describe it well like you do. I used to hate C cause I didn't understand anything but after watching your videos everything makes sense. It's very detailed and contains only information that we need to know in order to understand the concept. Thank you so much for great work.
the mathematical operation presented in the line: int mid = l + (r - 1) / 2; doesn't work for me. My compiler seems to go out of memory bounds because of this. I've tried: int mid = (l + r) / 2; and it worked.
It should be: int mid = l + (r - l) / 2 So it's an l not a 1. It's more complicated, but it's actually better to do it this way instead of (l + r) /2, see this video: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-JNFGvjATOUA.html
Great question! 😀 You could do it that way too, though what we do in this video is better in terms of preventing an integer overflow: stackoverflow.com/questions/25113506/why-m-l-r-l-2-instead-of-m-lr-2-avoid-overflow-in-c.
This number guessing game might be close to what you're looking for: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-41NmcgA1HF0.html And to my knowledge we can't really use binary search on an unsorted array, unless we sort it first. Here are some folks explaining why: www.quora.com/Can-binary-search-be-applied-on-unsorted-list
Very Nice Content Useful to all Plz make subtitles in english (In this video Subtitiles r translating in dutch when converted to english it doesn't make sense) Plz make C++ also , u r explaining very nice!!
That's so weird that it auto-generated the subtitles to Dutch! Thank you for letting me know, I will see if there is anything I can to do fix that. :-) Also, I have now started a series of C++ videos as well: ru-vid.com/group/PLA1FTfKBAEX6BdpNaWp2uw-YspHwY7qwW
It's interesting, but I'm not sure RU-vid will allow me to "re-generate" the subtitles as English. I may need to upload my own or something, what a pain!
Hello Again! I having a problem with binary searching...... So lets say that you tell you computer to "random generate" 10 numbers between 1 - 20. And you want to know if the number 7 have been generated. Do you need to bubble sort first before you use binary searching?
Yes, the list needs to be sorted before you can use binary search. You could use bubble sort, or you could use something like insertion sort, selection sort, quicksort, or merge sort. In terms of performance, for very small arrays like this, using insertion sort or selection sort would be best (better than bubble sort too). For larger arrays, using something like quicksort or merge sort would be better. We have videos on all these aglorithms too: Insertion Sort: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-Tz7vBodZqo8.html Selection Sort: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-YepJ7fDmyjI.html Quicksort: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-0jDiBM68NGU.html Merge Sort: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-LeWuki7AQLo.html
@@PortfolioCoursesNo actually when I click the gear icon I see: "Stable Volume" ; "Ambient Mode" ; "Playback speed" ; and "Quality" there is no closed captions or subtitles on the gear icon. Next to the gear icon on the left is "cc" button which is greyed out and when I hover over it the message reads -> "Subtitles/closed captions unavailable".
Weird, what type of device/software are you using? I'm using Firefox on MacOS. I'm thinking it could be a difference related to using web vs. app or something like that.