2.6.2 Binary Search Recursive Method

preview_player
Показать описание
Divide and Conquer
Binary search Recursive method
Analysis

Courses on Udemy
================
Java Programming

Data Structures using C and C++

C++ Programming
Рекомендации по теме
Комментарии
Автор

i wish there was a coding part also. i Have NEVER seen a teacher with this level of understanding in data structures.

mohammadfaisal
Автор

Your mastery in converting complicated algorithmic steps into the simple stages is impressive.

atulgunjal
Автор

Bari Sir, hats off to you. I brag to my friends that I was your student and thought me DSA during my engineering and every time I have an interview I make sure I go through some of your videos..

nitiKT
Автор

Sir, u are my hero sir
👑God of algorithms 👑
😇🌞😎💻
"Simply in the nptel outdated teachers are teaching the same concept for hours together
And u are awesome sir without missing out any of the concepts u are teaching better than them sir"
As enstien said "if u can't explain in simple, u have to understand well enough"
For the above qoute Ur best example sir
Thank u sir it's helping me a lot
God bless u sir

preethamm.n
Автор

Sir you are hero, superb !! Allah lambi zindagi de :)

mansoorkhattak
Автор

31/83 videos in, bought your course on data structures. Maybe jumping ahead of myself, but you're amazing at explaining this.

jessesinger
Автор

This is, by far the best tutorial for learning binary search I've ever seen.
Many people have sufficient knowledge and skills and they try passing them to others
but a few of them can deliver them in a convenient method like Abdul Bari Does.

mohamedatef
Автор

There is a slight mistake in your algorithm if(l==h) will throw you a stackoverflow error instead you should use

saran
Автор

Being from non cs background, it was very difficult for me to find time complexity of a algorithm. Your recurrence relation series has helped me alot.

abhilashpatel
Автор

You're so unique, I failed algorithm because I didn't understand it when my lecturer taught me. I am sure I will scatter my Saturday's exam curtesy of you Dr Abdul Bari.

Swansylinks
Автор

Thanks for this helpful playlist, you are the best.

I tried to implement the algorithm as it is in the video, it didn't work except for values already in the array.

My recommendation:
1- remove the if block
2- Modify the else block to be "if (l <= h)"
3- Add else block which returns -1 in case "l > h"

Here is my implementation in C++:

int BinSearch(int l, int h, int key, vector<int> arr) {
int mid;
if (l <= h) {
mid = (l + h) / 2;
if (key == arr[mid])
return mid;
else if (key < arr[mid])
return BinSearch(l, mid - 1, key, arr);
else
return BinSearch(mid + 1, h, key, arr);
}
else
return -1;
}

Finally, I want to thank you for your effort in this series which really helps me to learn from scratch.

mustafamahmoudahmed
Автор

I'm a non-cs background student and even i can understand such simple explanation. Hats off to you sir for your contribution sir.

practicemail
Автор

I never understood recursion, but after watching this video I know all of it
thanks, Abdul sir!

protek
Автор

I can only shay Thank You. I Just passed my algorithm exam with honors.
Thank you, thank you and again thank you

StefanoCocomazzi
Автор

Thank you for these videos Abdul Bari. I normally struggle to learn from videos, but your concisesness helps so much. I know that my focus won't be wasted, so I can listen intently for the full video.

backpropagated
Автор

Sir you should be guiding students for companies like google and amazon. Also please write a book on Data Structures definitely I will buy.

subramaniyanvg
Автор

now i am clear you teach it better then, even our university teacher.

AbdullahSiddiqui
Автор

this also is a good algorithm:
def RBinarySearch(arr, value, l = 0, h = 0):
if(l>h):
return -1
mid = int((l+h) /2)
if(arr[mid] == value):
return mid
elif (value > arr[mid]):
l = mid+1
else :
h = mid-1
return RBinarySearch(arr, value, l, h)

arr = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29]

print(RBinarySearch(arr, 25, 0, len(arr)-1))

khale-d
Автор

Sir in your recursive code, you didn't give a condition for when the element can't be found, i.e. you have to give a condition that when l>h return -1. Other than that amazing lectures

zureka
Автор

cannot express my gratitude. Thank you Mr Abdul - all of your videos are priceless! you're a legend. Thank you for helping to improve

evash