BS-1. Binary Search Introduction | Real Life Example | Iterative | Recursive | Overflow Cases

  Рет қаралды 284,755

take U forward

take U forward

Күн бұрын

Пікірлер: 297
@takeUforward
@takeUforward Жыл бұрын
Please comment understood and give us a like if you got everything :)
@sabyasachibiswal7790
@sabyasachibiswal7790 Жыл бұрын
Sir if possible can you please make a series on sliding windows ,2 pointers after this
@sabyasachibiswal7790
@sabyasachibiswal7790 Жыл бұрын
Salute to your dedication sir
@Demodulator7
@Demodulator7 Жыл бұрын
​@@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.
@dhruvsharma9230
@dhruvsharma9230 Жыл бұрын
now 2023 c++ , pls dont skip java , again saying refactor entire sries java , tell me bench how many projects u get C++
@dhruvsharma9230
@dhruvsharma9230 Жыл бұрын
all people now doing dsa java foregt C++ in next 2 years recession
@playtune9217
@playtune9217 Жыл бұрын
This guy does amazing work. If I can grasp it, anyone can follow this playlist. thanks man.
@Slice32gaming
@Slice32gaming Жыл бұрын
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
@CodePinaka
@CodePinaka Жыл бұрын
"Raj" may be not in dictionary, but one thing is sure that "Raj" is in our heart :)
@jaswinders2670
@jaswinders2670 8 ай бұрын
☺☺
@samarthpai5359
@samarthpai5359 Ай бұрын
finding it will take O(1)
@shubhamagarwal1434
@shubhamagarwal1434 3 ай бұрын
#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.
@nilesh69420
@nilesh69420 8 ай бұрын
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.
@pavankalyan6191
@pavankalyan6191 26 күн бұрын
same thought.
@bhumithakur9967
@bhumithakur9967 Жыл бұрын
Striver the way you teach is exceptional 👏 .
@anuragsingh8910
@anuragsingh8910 Жыл бұрын
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
@takeUforward Жыл бұрын
Thank you so much
@anuragsingh8910
@anuragsingh8910 Жыл бұрын
@@takeUforward Welcome ❤
@iWontFakeIt
@iWontFakeIt Жыл бұрын
​@@takeUforward completed same day
@sujitrishikumar8621
@sujitrishikumar8621 Жыл бұрын
@@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
@IT___AbhayGupta
@IT___AbhayGupta 11 ай бұрын
​@@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
@harshith1424
@harshith1424 Жыл бұрын
Bro dropped whole" binary search" album overnight 😂😂😂
@emtiazahmed5333
@emtiazahmed5333 Жыл бұрын
😂😂😂😂 sahi bola..bhaiya is on fire😂
@takeUforward
@takeUforward Жыл бұрын
Sorry pura nai ho paaya as website ka kaam chal raha tha, pura aa jaega 5/6 din me
@roshanraturi1040
@roshanraturi1040 Жыл бұрын
​​@@takeUforward bhya aap itna v kr rhe houtna hi bhoot h ❤
@surajpadihar5027
@surajpadihar5027 Жыл бұрын
Bcz he promised and he never forget his promises that why we love him ❤
@harshith1424
@harshith1424 Жыл бұрын
@@takeUforward arey bhai mai tho mazak kar Raha tha ....u r doing next level hardwork for students.... always thankful to you🙏
@vikasbagri1225
@vikasbagri1225 Жыл бұрын
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
@utkarshshrivastava2632
@utkarshshrivastava2632 Жыл бұрын
Loved the way how you always keep your promise and deliver premium quality content ! Hats off to the dedication man❤❤❤❤
@Harsh06g
@Harsh06g Жыл бұрын
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
@priyankarai7917
@priyankarai7917 Жыл бұрын
Amazing explaination sir ...first time i watch your video ...clear the binary search..
@RagaviSathiyamoorthy
@RagaviSathiyamoorthy Жыл бұрын
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
@jappanjotsingh9465
@jappanjotsingh9465 Жыл бұрын
LOVED ITACHI NOTEBOOK :)
@PiyushWandile-q5u
@PiyushWandile-q5u Жыл бұрын
Hats OFF to you Man for making such Content
@SiddhiAgrawal-m5l
@SiddhiAgrawal-m5l 3 ай бұрын
🎯 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
@tanishkarawat5266
@tanishkarawat5266 Жыл бұрын
Striver bhaiya ka dedication!!!!! Thanks a lot
@NandakishorGudala
@NandakishorGudala Жыл бұрын
understood i was new to lb, ub floor ,ceil ,i learnt them here .Thanks
@peanutcoder9361
@peanutcoder9361 3 ай бұрын
One of the best lecture for binary search
@johndurai2226
@johndurai2226 Жыл бұрын
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 .
@ritikarora108
@ritikarora108 10 ай бұрын
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.
@rishabh1S
@rishabh1S Жыл бұрын
Wow the best explaination!! Thanks Striver.
@CodeMode9313
@CodeMode9313 Жыл бұрын
Understood .... thank u so much bhaiya ...its the best i have ever seen ...salaam rocky bhai
@abhay9994
@abhay9994 Жыл бұрын
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
@Ravikantsingh-b4g
@Ravikantsingh-b4g Жыл бұрын
maja aagaya bhaiya wait kar rahe the bahut din se
@RumanaIslam-xs9rw
@RumanaIslam-xs9rw 4 ай бұрын
This is the best Binary Search explanation I have ever come across, Love from a lost cs soul
@rajeshkumarsahoo1257
@rajeshkumarsahoo1257 Жыл бұрын
Hats OFF to you Man.Thanks for gifting us an Amazing Playlist Like DP.❤❤❤❤❤❤
@nopecharon
@nopecharon Жыл бұрын
Thank you striver for the amazing videos.
@YATHARTHBHARDWAJ-y8m
@YATHARTHBHARDWAJ-y8m Жыл бұрын
Understood it very well THANK YOU SO MUCH SIR
@cinime
@cinime Жыл бұрын
Understood! Amazing explanation as always, thank you very very much for your effort!!
@utkarshsingh09
@utkarshsingh09 3 ай бұрын
All doubts clear ! Understood
@tanya8353
@tanya8353 11 ай бұрын
Your dedication is commendable Striver!!! Great job dude!!
@suryasaipalthi
@suryasaipalthi 6 ай бұрын
Understood. Crystal clear.
@Himani-t3g
@Himani-t3g 2 күн бұрын
understood! striver also heartfelt thank you
@infernogamer52
@infernogamer52 Жыл бұрын
Understood Bhaiya!
@ShravanKumar-wg9pv
@ShravanKumar-wg9pv 3 ай бұрын
വളരെ നന്ദി * _* (from kerala)
@pulkitjain5159
@pulkitjain5159 Жыл бұрын
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
@TheNStranger
@TheNStranger 8 ай бұрын
that's a great job bro. i like your every video after watching and submit question on leetcode😊😊 .
@div0826
@div0826 5 ай бұрын
You are just amazing. Please keep this good work going
@shibsankarpramanik768
@shibsankarpramanik768 Жыл бұрын
GOAT 🐐 of DSA
@shaurya2608
@shaurya2608 Жыл бұрын
I completed the Binary search questions on my own, but I'm having a lot of trouble with the String problems.
@hareshnayak7302
@hareshnayak7302 8 ай бұрын
Understood, thanks striver for this amazing video. Really enjoing your lecture videos.
@rajatyadav3949
@rajatyadav3949 Жыл бұрын
great BS Content i had watched all conceptual Dout's are clear!!
@abhishekjha9284
@abhishekjha9284 Жыл бұрын
striver bhaiya Always on fire🔥🔥🔥🔥🔥🔥
@RaviKumar-sn6tu
@RaviKumar-sn6tu 8 ай бұрын
crystal clear explaination✨✨✨✨
@ritikmalviya2580
@ritikmalviya2580 Жыл бұрын
Thanks bhaiya bhot time se intezar tha ❤❤❤
@striverdaaadi
@striverdaaadi 11 ай бұрын
awesome videos, best dsa videos ever
@_Arbaz_98
@_Arbaz_98 2 ай бұрын
Kuch alag tarika tha . Anyways bahut sahi tha
@kumaranuj03
@kumaranuj03 Жыл бұрын
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 😂🤣
@AbhinavPundhir
@AbhinavPundhir Жыл бұрын
Thanks bhaiya for all the hard work that you have put, now I am going to watch it😁
@komalkrishna7836
@komalkrishna7836 Жыл бұрын
Wow 😍 great explanation Striver 👏
@aakashsharma780
@aakashsharma780 Жыл бұрын
Thanks you Striver bhaiya You made it 🙌🙌 🎉
@sarangkumarsingh7901
@sarangkumarsingh7901 6 ай бұрын
Awesome bhaiya.................
@Manishgupta200
@Manishgupta200 Жыл бұрын
Good understanding with TC
@DeboleenaMukherjeeM23CSA008
@DeboleenaMukherjeeM23CSA008 4 ай бұрын
Thank you Striver😇
@deepanshutibrewal386
@deepanshutibrewal386 Жыл бұрын
Please give us Sliding Window Playlist . It is very very important and it is not available anywhere.
@CodeMode9313
@CodeMode9313 Жыл бұрын
u can also see for the aditya verma for sliding window ...its also good
@bhavyasharma3500
@bhavyasharma3500 Жыл бұрын
Striver sir jo bolte h vo kr k dikhate h , thanks ❤❤
@sujalGhorse-xh8bs
@sujalGhorse-xh8bs 8 ай бұрын
Why sound is not there?
@rushidesai2836
@rushidesai2836 2 ай бұрын
Unmute the sound macha
@sujalGhorse-xh8bs
@sujalGhorse-xh8bs 2 ай бұрын
@@rushidesai2836 ok macha
@pikkok7867
@pikkok7867 Жыл бұрын
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
@MaheshKumar-jc8sp
@MaheshKumar-jc8sp 2 ай бұрын
you are a champion
@ravalikatalks5285
@ravalikatalks5285 2 ай бұрын
good video bhaiya🥳
@SandeepPandey-i9y
@SandeepPandey-i9y Жыл бұрын
Please @takeuforward Make such more playlist on every topic please
@sahxzm
@sahxzm 2 ай бұрын
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
@growmoreyt4192
@growmoreyt4192 Жыл бұрын
completed first vide.
@sridharshree3034
@sridharshree3034 10 ай бұрын
Awesome thank You Vikram
@DeadPoolx1712
@DeadPoolx1712 3 ай бұрын
UNDERSTOOD:
@ashishpradhan6250
@ashishpradhan6250 6 ай бұрын
God level🛐
@DevanshiKapla
@DevanshiKapla Жыл бұрын
Thankyou thank you was waiting for this eagerly.
@maheshshirate2834
@maheshshirate2834 7 ай бұрын
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
@gautamsaxena4647
@gautamsaxena4647 Ай бұрын
understood bhaiya
@AyushKumar-ol5jp
@AyushKumar-ol5jp Жыл бұрын
Bhaiya binary search ko too chamka diye hoo💥
@abhaymandal4903
@abhaymandal4903 Жыл бұрын
First i like button , then i watch ❤
@kingbadshah452
@kingbadshah452 10 ай бұрын
understood everything thanks striver
@venkateshr2923
@venkateshr2923 8 ай бұрын
Is it a glitch, not able to hear anything in this video..
@sangumuruganp2867
@sangumuruganp2867 26 күн бұрын
In some devices video is streaming without audio. Try using other device or play directly in web browser of ur device.
@RS-vu5um
@RS-vu5um 8 ай бұрын
I don't hear any Audio for this video.
@karthik-varma-1579
@karthik-varma-1579 3 ай бұрын
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
@Raj-pi1pl
@Raj-pi1pl Жыл бұрын
Finally worth waiting
@hemanthkumar-pp8yn
@hemanthkumar-pp8yn 7 ай бұрын
I am not able to listen voice. Its getting cut right from beginning.. any reason!
@shrad6611
@shrad6611 Жыл бұрын
great playlist
@sabyasachibiswal7790
@sabyasachibiswal7790 Жыл бұрын
Salute to your dedication
@dpxy1599
@dpxy1599 Жыл бұрын
example was excellent.
@AruniPathak-p1e
@AruniPathak-p1e 4 ай бұрын
outstanding
@harshdiwase1941
@harshdiwase1941 9 ай бұрын
very good lecture
@_hulk748
@_hulk748 11 ай бұрын
Understood Sir🙇‍♂🙏✨💖
@ravalik8611
@ravalik8611 20 күн бұрын
Striver bhayya saying "its over" is like he is saying about a breakup
@sathya9922
@sathya9922 2 ай бұрын
The bestttt👏
@NazeerBashaShaik
@NazeerBashaShaik 7 ай бұрын
Understood, thank you.
@niteshshrivastav5424
@niteshshrivastav5424 Жыл бұрын
amazing bhaiya...
@shashipreetham5575
@shashipreetham5575 Жыл бұрын
Salute for ur dedication...
@tukaramgaikwad1012
@tukaramgaikwad1012 3 ай бұрын
Understood😀
@krishnaagarwal4065
@krishnaagarwal4065 2 ай бұрын
bhai literally ab lag rha hai ki kuch future haii coding mei....!!!!!!!!!!!!!!!!!!
@ajayramola9386
@ajayramola9386 Жыл бұрын
every teacher is a gangster until "raj vikramaditya" comes up with a red hoodie
@apratimghosh5707
@apratimghosh5707 Жыл бұрын
bruhh you're goated🐐
@kavyasree9760
@kavyasree9760 Жыл бұрын
you are amazing..........
@raZer.7_
@raZer.7_ 7 ай бұрын
Great video❤
@sara.rita.k
@sara.rita.k Жыл бұрын
@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 ?
@nirajpatil01
@nirajpatil01 Жыл бұрын
@takeuforward Brother Linked List pe playlist kab tak aayegi ??
@mooginiharika7412
@mooginiharika7412 3 ай бұрын
thank you sir
@ShubhamTiwari-ng7sp
@ShubhamTiwari-ng7sp 3 ай бұрын
Correction : - In reccursive part 25:57 in bs( ) function at last line there should be 'return bs (nums, low, mid-1, target)'
Binary Search Algorithm - Computerphile
18:34
Computerphile
Рет қаралды 164 М.
Симбу закрыли дома?! 🔒 #симба #симбочка #арти
00:41
Симбочка Пимпочка
Рет қаралды 5 МЛН
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 27 МЛН
BS-17. Aggressive Cows | Binary Search Hard
26:44
take U forward
Рет қаралды 176 М.
The Best Way to Learn Linux
9:45
Mental Outlaw
Рет қаралды 130 М.
8 patterns to solve 80% Leetcode problems
7:30
Sahil & Sarra
Рет қаралды 442 М.
BS-18. Allocate Books or Book Allocation | Hard Binary Search
27:29
take U forward
Рет қаралды 184 М.
Linear & Binary Search Code | Big O Notation
19:31
Telusko
Рет қаралды 36 М.
Симбу закрыли дома?! 🔒 #симба #симбочка #арти
00:41
Симбочка Пимпочка
Рет қаралды 5 МЛН