26:03 Just a small correction at line 6. It should be mid - 1 instead of high - 1. I checked in striver's website and it is correct there. Also, Excellent explanation as always.
🎯 Key points for quick navigation: 00:02:00 *🕰️ The video aims to explain binary search comprehensively, covering real-world examples, coding problem examples, and both iterative and recursive implementations.* 00:01:23 *📚 Binary search can be understood using a dictionary example, which is organized alphabetically and allows for efficient searching.* 02:44 *📖 Binary search can be applied when searching in any sorted search space, such as an array or dictionary, making it highly efficient.* 03:55 *🔄 Binary search involves repeatedly dividing the search space in half to efficiently locate a target item.* 06:06 *📋 Pseudocode for the iterative binary search is introduced, explaining the logic behind updating search bounds based on target comparisons.* 12:55 *🔍 If a binary search exhausts the search space without finding the target, it returns -1, indicating the target is not present.* 16:48 *📝 The iterative binary search code is presented, demonstrating the efficiency of this method in practice.* 17:18 *⚙️ Recursive implementation focuses on solving the problem through repeated function calls, with similar steps to the iterative approach.* 20:45 *🚫 Base case in a recursive binary search occurs when the search space is exhausted, allowing the function to stop and return -1.* 21:27 *🧩 Recursion effectively trims the search space by calling itself with updated bounds, improving search efficiency.* 00:21:55 *🔄 Discusses the logic for calling the recursive function for binary search, emphasising changes in the low and high pointers.* 00:23:05 *🧮 Explains how the first call calculates the middle of an array and adjusts search based on target comparison.* 00:24:26 *🔙 Details the step-by-step progression of recursive calls in binary search until reaching the base case returning -1.* 00:25:55 *🧩 Describes how recursive calls return -1 if the target is not found in the recursion tree, showcasing how the entire function handles it.* 00:27:25 *📉 Analyzes time complexity, illustrating how binary search reduces search space logarithmically with respect to base 2.* 00:29:10 *⚠️ Discusses the potential Overflow issue occurring if the middle point calculation exceeds the integer storage capacity.* 00:31:10 *📝 Provides solutions to Overflow issues, recommending writing an alternative expression for mid calculation or using `long long` data type.* 00:32:55 *👍 Concludes with encouragement to check the Binary Search playlist and highlights the importance of understanding binary search beyond arrays.* Made with HARPA AI
Understood it very well And the OVERFLOW part was awesome Keep up the good work Striver Although you have promised us 30+ videos but no worries as we know how busy you are Once again thanks for this amazing series
0:00 Introduction 1:27 Real Life Example 5:18 Coding Problem Example 13:22 Iterative Binary Search Code 17:15 Recursive Binary Search Code 26:18 Time Complexity Analysis 29:12 Overflow Case 32:46 Outro
@@takeUforward bhaiya ek question hai ......at the end of video aapne kaha ...INT MAX + INT MAX ...which is 2*INT MAX.......bhaiya kya yeh kisi variable me store hoga...then divide by 2 hoga........ agr aisa hoga tabhi na bhaiya overflow condition aayega....isem thora sa confusion hai bhaiya...please clear kar dijiye na bhaiya
@@sujitrishikumar8621INT MAX + INT MAX .... Which is 2*INT MAX , dono variable int type ke hai to int hi output aayega esa compiler samjhta hai, and int type ka memory block provide krta hai output store ke liye, but jb two int max ko add krege to vo int memory block mai store nhi ho payega jisse overflow condition aayegi , And variable mai store nhi ho raha hai , jb program ram mai aata hai run krne ke liye tabhi program ko memory milti hai , kitni memory lgne wali hai program ko or kaha lgne wali hai ye compile time pr decide ho jata hai
There was a mistake in your recursive code while submitting on Coding Ninjas, in the else statement you have written bs(nums,low,high-1,target) instead of bs(nums,low,mid-1,target), so it won't be O(logn) time complexity.
#Free Education For All.. # Bhishma Pitamah of DSA...You could have earned in lacs by putting it as paid couses on udamey or any other elaerning portals, but you decided to make it free...it requires a greate sacrifice and a feeling of giving back to community, there might be very few peope in world who does this...."विद्या का दान ही सर्वोत्तम दान होता है" Hats Off to you man, Salute from 10+ yrs exp guy from BLR, India.
Thank you so much for this wonderful video session and this is the first time i have clearly understood about the concept and it is very clear. Thank you
Waiting for the solution of Minimizing the maximum distance to gas station. Amazing series and thanks for the signIn / signUp functionality on the site really solved my problem
00:07 Binary search is a searching algorithm in a limited search space. 02:13 Binary search is a search algorithm applicable in a sorted area. 06:36 Binary search helps to reduce time complexity in searching. 08:37 Binary search trims down the search space by splitting it into halves. 12:59 Binary search works by dividing the search space between low and high and narrowing it down until the element is found or the search space is exhausted. 15:03 Binary Search is a simple and efficient searching algorithm. 19:01 Binary search is a recursive algorithm that repeatedly halves a sorted array to find an element. 20:50 Performing binary search using recursion and base case handling 24:39 The video explains how recursion works in binary search. 26:27 Binary search reduces the search space by half in each step. 30:27 Binary search can cause overflow when the search space becomes small and the low value reaches the maximum integer value. 32:35 Binary search Overflow case explained
Hi Raj, The recursive code that your wrote on CodeStudio has a slight mistake: when nums[mid] > target, high becomes mid-1, but in the recursive call you're passing high as high-1 [bs(nums, low, high-1, target)]. The code still runs because the values passed still exists however the no. of iterations to find the number will be higher.
@takeUforward Hi Raj, shouldn't we also add a condition to check if arr[low] or arr[high] is equal to target. just to save some iterations or stack calls, i know the time complexity would still be log n, but is it advisable to add such optimizations or not ?
elif target > nums[mid]: return binarysearch(nums, high, mid + 1, target) else: return binarysearch(nums, mid - 1, low, target) a change need to be made
Striver make a seperate chat space in take you forward as like a discord to get your channel updates in that chat space only and also make a thank note who want to thank you or write a testimonals which helped them to get placed. It Would be great if you read this so far. and I know You are go fast model you does this fast pace thank you lot for bs playlist
Binary search is a search algorithm that efficiently finds an element in a sorted array or sequence. It works by repeatedly dividing the search space in half, discarding the half that cannot contain the target element. Key moments: 00:13 Binary search is a structured path in this video, demonstrating how it works in real life. The video may be longer on the platform compared to others due to following a structured path. -The video will start with real-life examples to explain how binary search works in practical scenarios. -The video will then delve into coding examples to illustrate the implementation of binary search algorithms. -The concept of binary search will be further explained through a practical example of dividing a dictionary to locate specific properties. 06:07 The video explains the concept of binary search using a unique ordered list, demonstrating how to find a specific element efficiently by dividing the search space in half iteratively. -The speaker emphasizes the importance of understanding the index pointers and the significance of the middle element in binary search for efficient searching. -Exploring the role of specific indices and variables in binary search to determine the correct position of elements within the ordered list. -Demonstrating the iterative process of binary search by updating the search space based on comparisons with target values, showcasing the efficiency of the algorithm. 13:23 Understanding the process of binary search is crucial for coding problems. The video explains the iterative implementation of binary search with detailed steps and considerations. -Iterative implementation of binary search is explained with step-by-step guidance, aiding in understanding coding problems efficiently. -The video emphasizes the importance of correctly implementing binary search to efficiently solve coding challenges and optimize search processes. -The iterative approach to binary search is highlighted, showcasing how to handle different scenarios and make informed decisions for effective problem-solving. 18:13 Recursion in coding allows for repetitive functions to be executed with varying parameters, simplifying complex tasks. Understanding base cases and midpoints is crucial for recursion to work effectively. -Recursion simplifies repetitive tasks by reusing code with different inputs, enhancing efficiency in programming. -Base cases and midpoints play a vital role in recursion, guiding the flow of functions and ensuring correct execution. 26:20 Understanding the complexity of time is crucial in coding. Recursive code is demonstrated, showing how to trim elements and solve problems efficiently. -Recursive code is explained, emphasizing the importance of understanding time complexity in coding. -Trimming elements and recursive functions are discussed to showcase efficient problem-solving techniques in coding. -The video delves into examples of binary search and word search, highlighting the versatility and complexity of search algorithms beyond arrays. 32:55 Understanding the concept of binary search in depth is crucial for efficient problem-solving. Exploring different search space scenarios can lead to better algorithmic solutions. -Exploring the impact of search space variations on algorithmic solutions. It's essential to consider different scenarios for efficient problem-solving. -Emphasizing the importance of understanding binary search intricately for effective problem-solving strategies. Delving into search space optimization can enhance algorithm efficiency. Generated by sider.ai
I was like Maine notification bell to press Kiya tha fir bhi direct BST-8 ka notification aaya ....... Baki ke time par nahi aaya 🙄 ...... Fir channel pe aake check kiya to dekha ki bhaiya ne ek sath 8 video upload kar diye 😂🤣
Those who are having audio issue Open this video on browser and play Its not playing in youtube app. I dont know why and how Its only playing with audio in browser
Please comment understood and give us a like if you got everything :)
Sir if possible can you please make a series on sliding windows ,2 pointers after this
Salute to your dedication sir
@@sabyasachibiswal7790 as he is following the a2z sheet so i think next will be on string. Sliding window is on step 10 so it will take time i think.
now 2023 c++ , pls dont skip java , again saying refactor entire sries java , tell me bench how many projects u get C++
all people now doing dsa java foregt C++ in next 2 years recession
This guy does amazing work. If I can grasp it, anyone can follow this playlist. thanks man.
bhoat sahi bro masta kaam kar raha hai tu .jo loag course afford nahi kar shakte unko free maine sikha raha .India need people like you
26:03 Just a small correction at line 6. It should be mid - 1 instead of high - 1. I checked in striver's website and it is correct there. Also, Excellent explanation as always.
"Raj" may be not in dictionary, but one thing is sure that "Raj" is in our heart :)
☺☺
finding it will take O(1)
🎯 Key points for quick navigation:
00:02:00 *🕰️ The video aims to explain binary search comprehensively, covering real-world examples, coding problem examples, and both iterative and recursive implementations.*
00:01:23 *📚 Binary search can be understood using a dictionary example, which is organized alphabetically and allows for efficient searching.*
02:44 *📖 Binary search can be applied when searching in any sorted search space, such as an array or dictionary, making it highly efficient.*
03:55 *🔄 Binary search involves repeatedly dividing the search space in half to efficiently locate a target item.*
06:06 *📋 Pseudocode for the iterative binary search is introduced, explaining the logic behind updating search bounds based on target comparisons.*
12:55 *🔍 If a binary search exhausts the search space without finding the target, it returns -1, indicating the target is not present.*
16:48 *📝 The iterative binary search code is presented, demonstrating the efficiency of this method in practice.*
17:18 *⚙️ Recursive implementation focuses on solving the problem through repeated function calls, with similar steps to the iterative approach.*
20:45 *🚫 Base case in a recursive binary search occurs when the search space is exhausted, allowing the function to stop and return -1.*
21:27 *🧩 Recursion effectively trims the search space by calling itself with updated bounds, improving search efficiency.*
00:21:55 *🔄 Discusses the logic for calling the recursive function for binary search, emphasising changes in the low and high pointers.*
00:23:05 *🧮 Explains how the first call calculates the middle of an array and adjusts search based on target comparison.*
00:24:26 *🔙 Details the step-by-step progression of recursive calls in binary search until reaching the base case returning -1.*
00:25:55 *🧩 Describes how recursive calls return -1 if the target is not found in the recursion tree, showcasing how the entire function handles it.*
00:27:25 *📉 Analyzes time complexity, illustrating how binary search reduces search space logarithmically with respect to base 2.*
00:29:10 *⚠️ Discusses the potential Overflow issue occurring if the middle point calculation exceeds the integer storage capacity.*
00:31:10 *📝 Provides solutions to Overflow issues, recommending writing an alternative expression for mid calculation or using `long long` data type.*
00:32:55 *👍 Concludes with encouragement to check the Binary Search playlist and highlights the importance of understanding binary search beyond arrays.*
Made with HARPA AI
Striver the way you teach is exceptional 👏 .
Understood it very well
And the OVERFLOW part was awesome
Keep up the good work Striver
Although you have promised us 30+ videos but no worries as we know how busy you are
Once again thanks for this amazing series
0:00 Introduction
1:27 Real Life Example
5:18 Coding Problem Example
13:22 Iterative Binary Search Code
17:15 Recursive Binary Search Code
26:18 Time Complexity Analysis
29:12 Overflow Case
32:46 Outro
Thank you so much
@@takeUforward Welcome ❤
@@takeUforward completed same day
@@takeUforward bhaiya ek question hai ......at the end of video aapne kaha ...INT MAX + INT MAX ...which is 2*INT MAX.......bhaiya kya yeh kisi variable me store hoga...then divide by 2 hoga........
agr aisa hoga tabhi na bhaiya overflow condition aayega....isem thora sa confusion hai bhaiya...please clear kar dijiye na bhaiya
@@sujitrishikumar8621INT MAX + INT MAX .... Which is 2*INT MAX , dono variable int type ke hai to int hi output aayega esa compiler samjhta hai, and int type ka memory block provide krta hai output store ke liye, but jb two int max ko add krege to vo int memory block mai store nhi ho payega jisse overflow condition aayegi ,
And variable mai store nhi ho raha hai , jb program ram mai aata hai run krne ke liye tabhi program ko memory milti hai , kitni memory lgne wali hai program ko or kaha lgne wali hai ye compile time pr decide ho jata hai
Bro dropped whole" binary search" album overnight 😂😂😂
😂😂😂😂 sahi bola..bhaiya is on fire😂
Sorry pura nai ho paaya as website ka kaam chal raha tha, pura aa jaega 5/6 din me
@@takeUforward bhya aap itna v kr rhe houtna hi bhoot h ❤
Bcz he promised and he never forget his promises that why we love him ❤
@@takeUforward arey bhai mai tho mazak kar Raha tha ....u r doing next level hardwork for students.... always thankful to you🙏
Loved the way how you always keep your promise and deliver premium quality content ! Hats off to the dedication man❤❤❤❤
Amazing explaination sir ...first time i watch your video ...clear the binary search..
There was a mistake in your recursive code while submitting on Coding Ninjas, in the else statement you have written bs(nums,low,high-1,target) instead of bs(nums,low,mid-1,target), so it won't be O(logn) time complexity.
Hats OFF to you bhaiyaa for providing us with much of premium quality content( Don't have words to say for your efforts)
Thank you so much
#Free Education For All.. # Bhishma Pitamah of DSA...You could have earned in lacs by putting it as paid couses on udamey or any other elaerning portals, but you decided to make it free...it requires a greate sacrifice and a feeling of giving back to community, there might be very few peope in world who does this...."विद्या का दान ही सर्वोत्तम दान होता है" Hats Off to you man, Salute from 10+ yrs exp guy from BLR, India.
Thank you so much for this wonderful video session and this is the first time i have clearly understood about the concept and it is very clear. Thank you
understood i was new to lb, ub floor ,ceil ,i learnt them here .Thanks
Hats OFF to you Man for making such Content
LOVED ITACHI NOTEBOOK :)
Wow the best explaination!! Thanks Striver.
Thank you striver for the amazing videos.
One of the best lecture for binary search
Why sound is not there?
Unmute the sound macha
@@rushidesai2836 ok macha
Striver bhaiya ka dedication!!!!! Thanks a lot
Understood it very well
THANK YOU SO MUCH SIR
Understood .... thank u so much bhaiya ...its the best i have ever seen ...salaam rocky bhai
Hats OFF to you Man.Thanks for gifting us an Amazing Playlist Like DP.❤❤❤❤❤❤
Your dedication is commendable Striver!!! Great job dude!!
Please give us Sliding Window Playlist . It is very very important and it is not available anywhere.
u can also see for the aditya verma for sliding window ...its also good
Is it a glitch, not able to hear anything in this video..
Understood. Crystal clear.
I completed the Binary search questions on my own, but I'm having a lot of trouble with the String problems.
striver you are very loyal person because you told this video will be post jun 1st .Thank you for the Video for us. Keep doing .
All doubts clear ! Understood
Waiting for the solution of Minimizing the maximum distance to gas station. Amazing series and thanks for the signIn / signUp functionality on the site really solved my problem
maja aagaya bhaiya wait kar rahe the bahut din se
Understood Bhaiya!
Understood! Amazing explanation as always, thank you very very much for your effort!!
This is the best Binary Search explanation I have ever come across, Love from a lost cs soul
Understood ❤
that's a great job bro. i like your every video after watching and submit question on leetcode😊😊 .
Understood, thanks striver for this amazing video. Really enjoing your lecture videos.
You are just amazing. Please keep this good work going
I am not able to listen voice. Its getting cut right from beginning.. any reason!
Please @takeuforward
Make such more playlist on every topic please
awesome videos, best dsa videos ever
crystal clear explaination✨✨✨✨
Thank you Striver😇
00:07 Binary search is a searching algorithm in a limited search space.
02:13 Binary search is a search algorithm applicable in a sorted area.
06:36 Binary search helps to reduce time complexity in searching.
08:37 Binary search trims down the search space by splitting it into halves.
12:59 Binary search works by dividing the search space between low and high and narrowing it down until the element is found or the search space is exhausted.
15:03 Binary Search is a simple and efficient searching algorithm.
19:01 Binary search is a recursive algorithm that repeatedly halves a sorted array to find an element.
20:50 Performing binary search using recursion and base case handling
24:39 The video explains how recursion works in binary search.
26:27 Binary search reduces the search space by half in each step.
30:27 Binary search can cause overflow when the search space becomes small and the low value reaches the maximum integer value.
32:35 Binary search Overflow case explained
great BS Content i had watched all conceptual Dout's are clear!!
@takeuforward Brother Linked List pe playlist kab tak aayegi ??
Wow 😍 great explanation Striver 👏
Thanks bhaiya for all the hard work that you have put, now I am going to watch it😁
Awesome thank You Vikram
Hi Raj,
The recursive code that your wrote on CodeStudio has a slight mistake:
when nums[mid] > target, high becomes mid-1, but in the recursive call you're passing high as high-1 [bs(nums, low, high-1, target)]. The code still runs because the values passed still exists however the no. of iterations to find the number will be higher.
Good understanding with TC
you are a champion
@takeUforward Hi Raj, shouldn't we also add a condition to check if arr[low] or arr[high] is equal to target. just to save some iterations or stack calls, i know the time complexity would still be log n, but is it advisable to add such optimizations or not ?
striver bhaiya Always on fire🔥🔥🔥🔥🔥🔥
Finally worth waiting
good video bhaiya🥳
വളരെ നന്ദി * _* (from kerala)
understood everything thanks striver
Thanks bhaiya bhot time se intezar tha ❤❤❤
Thanks you Striver bhaiya You made it 🙌🙌 🎉
Awesome bhaiya.................
great playlist
Kuch alag tarika tha . Anyways bahut sahi tha
understood bhaiya
elif target > nums[mid]:
return binarysearch(nums, high, mid + 1, target)
else:
return binarysearch(nums, mid - 1, low, target)
a change need to be made
Striver make a seperate chat space in take you forward as like a discord to get your channel updates in that chat space only
and also make a thank note who want to thank you or write a testimonals which helped them to get placed.
It Would be great if you read this so far. and I know You are go fast model you does this fast pace
thank you lot for bs playlist
Understood, thank you.
Salute to your dedication
Binary search is a search algorithm that efficiently finds an element in a sorted array or sequence. It works by repeatedly dividing the search space in half, discarding the half that cannot contain the target element.
Key moments:
00:13 Binary search is a structured path in this video, demonstrating how it works in real life. The video may be longer on the platform compared to others due to following a structured path.
-The video will start with real-life examples to explain how binary search works in practical scenarios.
-The video will then delve into coding examples to illustrate the implementation of binary search algorithms.
-The concept of binary search will be further explained through a practical example of dividing a dictionary to locate specific properties.
06:07 The video explains the concept of binary search using a unique ordered list, demonstrating how to find a specific element efficiently by dividing the search space in half iteratively.
-The speaker emphasizes the importance of understanding the index pointers and the significance of the middle element in binary search for efficient searching.
-Exploring the role of specific indices and variables in binary search to determine the correct position of elements within the ordered list.
-Demonstrating the iterative process of binary search by updating the search space based on comparisons with target values, showcasing the efficiency of the algorithm.
13:23 Understanding the process of binary search is crucial for coding problems. The video explains the iterative implementation of binary search with detailed steps and considerations.
-Iterative implementation of binary search is explained with step-by-step guidance, aiding in understanding coding problems efficiently.
-The video emphasizes the importance of correctly implementing binary search to efficiently solve coding challenges and optimize search processes.
-The iterative approach to binary search is highlighted, showcasing how to handle different scenarios and make informed decisions for effective problem-solving.
18:13 Recursion in coding allows for repetitive functions to be executed with varying parameters, simplifying complex tasks. Understanding base cases and midpoints is crucial for recursion to work effectively.
-Recursion simplifies repetitive tasks by reusing code with different inputs, enhancing efficiency in programming.
-Base cases and midpoints play a vital role in recursion, guiding the flow of functions and ensuring correct execution.
26:20 Understanding the complexity of time is crucial in coding. Recursive code is demonstrated, showing how to trim elements and solve problems efficiently.
-Recursive code is explained, emphasizing the importance of understanding time complexity in coding.
-Trimming elements and recursive functions are discussed to showcase efficient problem-solving techniques in coding.
-The video delves into examples of binary search and word search, highlighting the versatility and complexity of search algorithms beyond arrays.
32:55 Understanding the concept of binary search in depth is crucial for efficient problem-solving. Exploring different search space scenarios can lead to better algorithmic solutions.
-Exploring the impact of search space variations on algorithmic solutions. It's essential to consider different scenarios for efficient problem-solving.
-Emphasizing the importance of understanding binary search intricately for effective problem-solving strategies. Delving into search space optimization can enhance algorithm efficiency.
Generated by sider.ai
Thankyou thank you was waiting for this eagerly.
UNDERSTOOD
The bestttt👏
First i like button , then i watch ❤
I don't hear any Audio for this video.
GOAT 🐐 of DSA
Understood Sir🙇♂🙏✨💖
God level🛐
UNDERSTOOD:
example was excellent.
completed first vide.
Salute for ur dedication...
I was like Maine notification bell to press Kiya tha fir bhi direct BST-8 ka notification aaya ....... Baki ke time par nahi aaya 🙄 ...... Fir channel pe aake check kiya to dekha ki bhaiya ne ek sath 8 video upload kar diye 😂🤣
understood👍
understood😍
outstanding
bruhh you're goated🐐
Striver sir jo bolte h vo kr k dikhate h , thanks ❤❤
Those who are having audio issue
Open this video on browser and play
Its not playing in youtube app.
I dont know why and how
Its only playing with audio in browser
Great video❤
thank you sir
very good lecture
you are amazing..........
Understood✅🔥🔥
Understood😀
Understood !! 😎😎