Binary Search Algorithm - Theory + Code

Binary Search Algorithm - Theory + Code

Kunal Kushwaha

2 года назад

479,092 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Mohit Balwani
Mohit Balwani - 15.08.2021 16:34

That's what I expected!
I already know binary search but knew that I will definitely learn something new from every video of this playlist. And guess what, I learned the improved version of binary search formula (start + (end - start) /2 ) !
Thanks a lot Kunal ❤😄

Ответить
29 TECH
29 TECH - 19.10.2023 09:39

if (strs.length == 0) return new ArrayList<>();

Map<String, List<String>> ans = new HashMap<>();

for (String s : strs) {
char[] ca = s.toCharArray();
Arrays.sort(ca);
String key = String.valueOf(ca);
if (!ans.containsKey(key)) ans.put(key, new ArrayList<>());
ans.get(key).add(s);
}

return new ArrayList<>(ans.values());

Ответить
Shashank Pratapwar
Shashank Pratapwar - 17.10.2023 10:47

You are doing a real noble work. Huge respect❤

Ответить
Maliha Fathima
Maliha Fathima - 16.10.2023 05:39

Where are the assignment qs ???for every vdeo

Ответить
Beka
Beka - 10.10.2023 12:25

Congrats 500

Ответить
FUROR
FUROR - 05.10.2023 21:30

great vid of dsa

Ответить
TE-78 Tarush Wagh
TE-78 Tarush Wagh - 28.09.2023 14:06

This guy is on another level in terms of teaching method. You don't know kunal how much you are helping people learn these complex things in the easiest way possible. Thanks a lot. You deserve the world kunal.

Ответить
Vaibhavi Mishra
Vaibhavi Mishra - 25.09.2023 19:56

U r really best👌thanku sir for helping us☺️🙏

Ответить
motivation quotes
motivation quotes - 22.09.2023 23:03

if u have good quality content then why are u put this course completely free?

Ответить
PaiGuy
PaiGuy - 22.09.2023 15:48

Where is discord channel link?

Ответить
ALOK SINGH
ALOK SINGH - 21.09.2023 21:52

thank uu

Ответить
Nishant Chandra
Nishant Chandra - 19.09.2023 09:56

what if we compare for equality with start and end also, with mid, bcz sometimes our end and start values are the ones we're looking for ???

Ответить
Harsh Gawali
Harsh Gawali - 18.09.2023 12:26

keep it up man! really a good course..

Ответить
Pvs Mohan
Pvs Mohan - 17.09.2023 10:29

Real coach 🙇

Ответить
Creative Blend
Creative Blend - 14.09.2023 16:59

Thank you so much!

Ответить
Rishita Bhriegu
Rishita Bhriegu - 14.09.2023 11:28

Could you kindly direct me to where I can access the links to the questions?

Ответить
Ameya Belvalkar
Ameya Belvalkar - 12.09.2023 13:03

Had Facing Time Limit Exceeded or Runtime Error At Many Binary Search Algorithms Problem but mid=start+(end-start)/2 helped me alot 🤩 Thankyou So Much Kunal

Ответить
Kshitij Rajendra
Kshitij Rajendra - 12.09.2023 06:45

Legitimately what a great explanation

Ответить
SAMIRAN ROYY
SAMIRAN ROYY - 05.09.2023 14:54

Sir love you so much..❤❤❤❤ happy teacher's day to you ❤❤❤❤❤❤

Ответить
Padhle bhai
Padhle bhai - 27.08.2023 15:30

Thanks sir

Ответить
shahiyan khan
shahiyan khan - 20.08.2023 08:19

Is it worth watching this course in 2023?

Ответить
Journey Of C
Journey Of C - 18.08.2023 17:59

done the theory of BS, now on to question

Ответить
xyz
xyz - 17.08.2023 15:48

heyy, you used while(start <= end) loop even in the order agnostics binary search code , i mean it will never enter the loop then if its decreasingly sorted

Ответить
Daniel.S
Daniel.S - 09.08.2023 15:42

nice!

Ответить
706 _C.Sivananth
706 _C.Sivananth - 06.08.2023 19:25

Dsa with kunal💥

Ответить
Kartikesh Pachkawade
Kartikesh Pachkawade - 04.08.2023 18:50

you are great bro.... !

Ответить
sai melodies
sai melodies - 03.08.2023 22:00

one of the best derivation of binary search time complexity i have ever seen!

Ответить
Satin Creditcare
Satin Creditcare - 26.07.2023 15:03

where is your dyanamic programming playlist

Ответить
Sourav Sinha
Sourav Sinha - 25.07.2023 16:28

one of the best video, everyone teaches the same binary
but here : OMG
order agnostic/ proper dry run for time complexity
new way for finding the middle
thanks a lot

Ответить
Chick Silky
Chick Silky - 25.07.2023 05:15

This video is awesome. Can you give this video a auto subtitle plz, my english is bad😢😢

Ответить
KEERTHI GOWNI
KEERTHI GOWNI - 24.07.2023 20:09

Thanks a lot Kunal ❤️

Ответить
Prasad Ranjane
Prasad Ranjane - 20.07.2023 18:13

These videos have helped me a lot this past month. Very grateful to Kunal for doing this, for helping students like us prepare for interviews. I am very eager for the upcoming videos and I hope you post them as soon as possible.

Ответить
Thor
Thor - 18.07.2023 00:54

Very easy explanation Kunal! very excited to continue this course.

Ответить
Rimpy yadav
Rimpy yadav - 16.07.2023 12:56

Thank you soo much Bhaiya , I am learning first time Binary Search and trust me the concept is crystal clear 💚

Ответить
Telugu anime lub
Telugu anime lub - 14.07.2023 16:23

package BinarySearch;

public class OrderAgnosticBS{
public static void main(String[] args) {
int[] arr = {90, 89, 34, 77, 51, 89, 53, 77, 20};
int target = 34;
int ans = orderAgnostic(arr, target);
System.out.println(ans);
}

static int orderAgnostic(int[] arr, int target) {
int start = 0;
int end = arr.length - 1;
boolean isAsc = arr[start] < arr[end];

while (start <= end) {
int mid = start + (end - start) / 2;

if (arr[mid] == target) {
return mid;
}

if (isAsc) {
if (target < arr[mid]) {
end = mid - 1;
} else {
start = mid + 1;
}
} else {
if (target > arr[mid]) {
end = mid - 1;
} else {
start = mid + 1;
}
}
}

return -1;
}
}

Check my code please im getting -1 as output which is incorrect

Ответить
Dixit Parmar
Dixit Parmar - 14.07.2023 16:08

MORE ON FEED.

Ответить
hemanth kumar Reddy
hemanth kumar Reddy - 14.07.2023 10:27

Thank you Very much Kunal❤

Ответить
zaidani shaik
zaidani shaik - 27.06.2023 18:50

he said he will complete this playlist in 2 months... hmmmmm.... almost two years now.. lol

Ответить
MASUD SK
MASUD SK - 26.06.2023 17:13

you doing really good sir

Ответить
Dipak Borase
Dipak Borase - 24.06.2023 10:27

what is my arr[start] == arr[end]

Ответить
Curiosity Buster
Curiosity Buster - 21.06.2023 15:51

Respect for youu bro

Ответить
Roaming Rumors
Roaming Rumors - 19.06.2023 12:21

Nice Cap🤠

Ответить
anshul tanwar
anshul tanwar - 16.06.2023 01:45

why don't you ever smile ?

Ответить