C++ Programming: Binary Search Algorithm

preview_player
Показать описание
Concepts:
How the binary search algorithm works
Performance of binary search in comparison to linear search
Binary search cuts the search space in half on each comparison
Implementation of binary search in C++
Binary search has log(n) running time (time complexity).
Рекомендации по теме
Комментарии
Автор

I have seen the Linear search algorithm you completely figured out for me. Your teaching way is a piece of cake.
Watching from Ethiopia. Thanks a bunch.

yasina
Автор

this is year 2024 and this stuff is still relevant, man c++ IS evergreen

studyfreak
Автор

WOW. Thank you! Programmers tend to be really snobby when it comes to helping. WE NEED MORE PROGRAMMERS LIKE YOU!

christianvillamor
Автор

Very well explained. I thought binary search was something awful when I saw it on my last exam. Thank you very much!

uzumakit
Автор

Pls dont stop making this videos. They really help!

mountgraph
Автор

I've my Computer Science boards practical exam on 1st Feb. U helped me a lot.... Thanks man

opiumslave
Автор

I love you man
Even my doctor couldn't make it this simple

NatsukiSY
Автор

Thanks so much - I have listened to your videos on arrays and passing arrays to functions - now I finally think I get the concepts - the explanations were clear and systematic - keep posting more videos - kudos sir for sharing your knowledge in a way that communicates to the student.

rajcodes
Автор

Thank you so much! I have a comprehensive c++ final today (it will cover material from both this and the previous semesters). Cheers!

eaglebaize
Автор

 Using a C++ array of STRUCTUREs, write a program that takes input of student information - for 10 students - like:
1) Student ID.
2) Student name.
3) Course marks (5 courses for each student).

 The program provides below functionality:
1) Show all records.
2) Search and display a student record on ID.
3) Modify the record of a particular student.
4) Show the passing percentage for each course.
5) Show the names of students who failed in a particular course.
6) Show the total marks, the percentage, and the overall letter grade for individual students.
7) Show the names and the letter grades of all students in each course.
9) Show the student names for each letter grade in each course [ A >= 90% - B >= 80% - C >= 70% - D >= 60% - F < 60% ].

 It is required to write a modular program.

snipere
Автор

So basically, we can't do binary search if the array isn't sorted from low to high?
Unlike linear search that can do even though if the array isn't sorted (random number)

lamp_x
Автор

When dealing with huge arrays you risk to overflow when calculating mid. A safer way is: mid = low + (high - low) / 2 .

vulcuemil
Автор

you are good at i didn't find any video that made it as clear as you did!.... thanks a lot;... coz tomorrow is my 12th grade final exam.

babbalgts
Автор

Thank you so much i've tried to understand this algorithm for 2 days even though this isnt that hard

grigorebordea
Автор

It was really cool ! But here is the question though : What if the list/array is unsorted ; I mean if there is a large search space, say 50000 elements ; would we be able to sort it manually ? - NO. So, why don't we have a function for sorting too?

Thinking practically, there are not gonna be arrays with just 8 or 10 or 50 elements, so i think we need it.

Comment down your thoughts on this. :)

aarjavbaxi
Автор

Great video! Amazing! Thank you for uploading sir!
Sir which one do you think is the best compiler ( user friendly and easy to understand)?

raghurammuthyala
Автор

watch 4 videos looking for a simple detail concerning the algorithm. You had it.

corrondo
Автор

with C++, there is no need for binary search. Just store data into set STL data structure and use its set::find() member function. But thanks for explaining binary search algo.

spicytuna
Автор

@ReelLearning you made it so simple and logical to understand.Thanks for the video it helped me a lot. :) By the way what is the program you're using to write the code and compile it?

Gooneryz
Автор

your mid point calculation can cause overflow

stevezes