BS-4. Search Element in Rotated Sorted Array - I

Sdílet
Vložit
  • čas přidán 31. 05. 2023
  • Problem Link: bit.ly/3OmIp5d
    Notes/C++/Java/Python codes: takeuforward.org/data-structu...
    We have solved the problem, and we have gone from brute force and ended with the most optimal solution. Every approach's code has been written in the video itself. Also, we have covered the algorithm with intuition.
    Full Course: bit.ly/tufA2ZYt
    You can follow me across social media, all my handles are below:
    Linkedin/Instagram/Telegram: linktr.ee/takeUforward
    0:00 Introduction of Course

Komentáře • 391

  • @takeUforward
    @takeUforward  Před rokem +110

    Please comment understood and give us a like if you got everything :)

  • @abhisheksinghmehra9576
    @abhisheksinghmehra9576 Před rokem +134

    We never move backward bcoz we have Take You Forward😇

  • @yash-seth
    @yash-seth Před 10 měsíci +28

    God tier explanation. I truly can't put in words how easily and clearly you were able to explain a seemingly confusing question!

  • @chaudharyalisha7175
    @chaudharyalisha7175 Před 8 měsíci +17

    No wonder how demotivated I was when I saw that question and was looking for a good explanation since last 7 days (no, not even exaggerating). But, this man is love!!! Keep going @Striver :) You're our hope!!

  • @junaidahmed3615
    @junaidahmed3615 Před 10 měsíci +7

    what an absolutely great explanation. i watched another video before this and it was so convoluted for no reason. yours is so simple and easy to grasp

  • @hilal937
    @hilal937 Před 8 měsíci +6

    I was struggling with Binary search on sorted array for a long time,
    Your key point "Eliminate one half" has cleared my confusion.
    Thank you so much Striver

  • @lofireverbz-wy7go
    @lofireverbz-wy7go Před 11 měsíci +22

    09:56 seriously i watched this many times to see your expression 😄

    • @yoongicorn7973
      @yoongicorn7973 Před 8 měsíci +3

      Yeah and The little smile when he continued... so cute ❤

    • @lofireverbz-wy7go
      @lofireverbz-wy7go Před 8 měsíci

      that,s nice on which lecture you are currently
      @@yoongicorn7973

  • @monstercoder3665
    @monstercoder3665 Před rokem +66

    None can compete with this man....!!! Simply amazing 👏. Great Work Striver Bhaiyya
    #DSA ka baap.
    The best thing about you is that you are not paid and spreading knowledge to all the aspirants...

    • @iamnoob7593
      @iamnoob7593 Před rokem +3

      I think people should pay for this next level quality content.

    • @shubhamkumar-hx1fb
      @shubhamkumar-hx1fb Před 8 měsíci

      @@iamnoob7593 haa...if u wish to.. then plss donate that money to some nearby ngos.

  • @cinime
    @cinime Před rokem +2

    Understood! Super fantastic explanation as always, thank you so so much for your effort!!

  • @nagame859
    @nagame859 Před rokem

    Understood as always! The intuition/approach is just awesome🤩. Spellbound!

  • @ML-ok9nf
    @ML-ok9nf Před 8 měsíci +2

    One of the best explanations for this problem on the internet!

  • @mehulthuletiya497
    @mehulthuletiya497 Před rokem +30

    00:24 Problem statement
    01:06 Example
    01:43 Solution-01 (Linear Search)
    02:21 Solution-02 (Binary Search)
    05:00 Dry-run
    11:42 Pseudocode
    15:17 Code
    15:28 Complexity

  • @ishangujarathi10
    @ishangujarathi10 Před rokem +1

    mann unbelievable intuition and explanation!! loved it !!! understood completely

  • @junaiid0104
    @junaiid0104 Před 18 dny +1

    crazy concept striver ! I'm just loving your binary search playlist!!!

  • @kaushiksen2190
    @kaushiksen2190 Před 9 měsíci +1

    Amazing video, very good explanations, took sometime to understand but went through it again and again to understand it completely. Thanks for making such quality content Striver Bhai

  • @pratikkumarsingh8114
    @pratikkumarsingh8114 Před 8 měsíci +2

    Understood bhaiya , thw way of teching is another level, I don't have words to express my feelings. Thanks a lot, bhaiya!!!

  • @mriit3025
    @mriit3025 Před 2 měsíci

    best possible understanding through the BS playlist!

  • @reyanshmishra7676
    @reyanshmishra7676 Před rokem +12

    The best explanation I have found for this problem.
    Alog is very simple now
    1. Identity the sorted half.
    2. Check if the target lies in the sorted half.
    Thats it you need to do this two things only.

  • @revanthkumar5417
    @revanthkumar5417 Před rokem

    Best explanation so far in binary search

  • @k.satish3663
    @k.satish3663 Před rokem

    Totally understood.your teaching is superb.thank you

  • @swathigp3818
    @swathigp3818 Před 4 měsíci

    This great quality content for free !!! Amazing work , please keep making these great videos 👏👏👏👏

  • @adarshmv261
    @adarshmv261 Před 3 měsíci

    Understood. The best explanation on youtube for this problem..

  • @hrishii.02
    @hrishii.02 Před měsícem

    Understood! What a simple and affective explaination

  • @user-pr8ir3ow3v
    @user-pr8ir3ow3v Před rokem +2

    Great Raj bhai... you deserve to be in elite class.
    keep rocking

  • @HarshSingh-hk8fe
    @HarshSingh-hk8fe Před 6 měsíci

    bro the way you explain is just amazing thanks a lot

  • @kumpatisupriya3947
    @kumpatisupriya3947 Před 8 měsíci

    What an explanation bro..
    You are our lives savior 🙏🙏

  • @venkatesasrikanthdhulipala9486
    @venkatesasrikanthdhulipala9486 Před 9 měsíci +3

    one small correction in the code it will fail if the array is [3,1] and target = 1
    because of code in line no 9 i.e k

  • @ADITYASRIVASTAVABCE
    @ADITYASRIVASTAVABCE Před rokem

    Thankyou for clear explanation. Loved it.

  • @user-ti3bd8mp1w
    @user-ti3bd8mp1w Před rokem

    understood
    Thank you striver for making things easy...

  • @venkatsaireddy1412
    @venkatsaireddy1412 Před 5 měsíci +1

    Thank You Raj Vikramaditya.
    I am a scaler student , i fond of Your teaching skills more than scaler instructors.

  • @rashmirsd
    @rashmirsd Před rokem

    Very nice explanation. Thank you

  • @hareshnayak7302
    @hareshnayak7302 Před 4 měsíci

    Understood,Thanks stiver for this amazing video.

  • @akaashk623
    @akaashk623 Před 10 měsíci

    Greatly explained 👏👏

  • @UserUser-tn8tv
    @UserUser-tn8tv Před 6 měsíci

    Understood Please keep consistent and eventually complete the series of A to Z DSA Course....
    Thank You

  • @sanchisingh5117
    @sanchisingh5117 Před rokem

    striver's explanations are the best

  • @rajkumarvb5197
    @rajkumarvb5197 Před 8 měsíci

    Understood, thanks for your efforts!

  • @vinitverma1741
    @vinitverma1741 Před 9 měsíci +1

    Thank u for such a great explaination

  • @manishdhekane5393
    @manishdhekane5393 Před rokem

    Understood very well !

  • @abhimanyuambastha2595
    @abhimanyuambastha2595 Před 5 měsíci +1

    Looked at neetcode video, then yours. His explanation was a bit confusing and had to do some examples to understand it. Yours almost made it a regular easy binary search

  • @user-el6hv6em7m
    @user-el6hv6em7m Před rokem

    Understood it very well :)

  • @ayushichoudhary1019
    @ayushichoudhary1019 Před rokem

    Best Explanation!

  • @myproject6768
    @myproject6768 Před rokem +1

    Absolutely understand ❤

  • @prathamrawat6298
    @prathamrawat6298 Před 25 dny

    bhaiya bhot bhot bhot hi aacha genuinely , bhot pyara samjhaya, too good!

  • @prernagupta7450
    @prernagupta7450 Před 5 měsíci

    YOU Can understand very well and i see a many video but my concept is not clear but just i see that video which would be clearly the concept very easily

  • @user-iv1ik6nq3y
    @user-iv1ik6nq3y Před měsícem

    Great explanation.

  • @VasanthChoudary-uc5cz
    @VasanthChoudary-uc5cz Před 8 měsíci +1

    Thankyou for providing this course for free bro.

  • @unknown2003august
    @unknown2003august Před měsícem +1

    Notes for me☺
    As we get our mid at any index checks arr[num]==target if it satisfies return here.
    After that
    Case 1>
    Array is left sorted(we check it by standing on mid),
    ==>Checks where our target lies in sorted(between low to mid ) or outside it by using
    if(arr[low]=target)
    if it lies inside this it indicates we need to collapse window by taking high to mid -1 otherwise low to mid+1
    Case 2>
    Array is right sorted similarly we check for it and updates our low and high accordingly
    if we never get it we return -1 to it

  • @radha7492
    @radha7492 Před 10 měsíci +1

    thank you so much sir...respect for your amazing efforts...really no one teaches better than you... raj cum striver..i wish for your long life and happiness..

  • @umangkumar2005
    @umangkumar2005 Před 5 měsíci

    This is the best explanation

  • @nikhilkumarjamwal5322
    @nikhilkumarjamwal5322 Před 8 měsíci

    Nice Explanation!👍

  • @Abhishekkumarnjw22-vf7cr

    Great help you are doing

  • @neerajpruthi8350
    @neerajpruthi8350 Před 5 měsíci

    Love the explanation. THanks

  • @harshdiwan9283
    @harshdiwan9283 Před rokem

    understood very well 🙌

  • @rtheame4704
    @rtheame4704 Před 2 měsíci

    Very well explained 👏🏻👏🏻

  • @tree7500
    @tree7500 Před rokem

    yes understood will try it out

  • @rakshitraushan1650
    @rakshitraushan1650 Před 4 měsíci

    Understood bro!! Ur a gem!

  • @beingproductive22
    @beingproductive22 Před 6 měsíci +3

    here after love babar lec - 14 for rotated sorted array he is using the concept of pivot element which is little messy
    but striver what a lovely lovely explanation
    in 1 go i understood and coded it myself

    • @Josuke217
      @Josuke217 Před 12 dny

      I learned recursion stack and queues from him , he's not a good teacher .

  • @BalajiG-ms3vu
    @BalajiG-ms3vu Před 3 měsíci

    Understood bro,thank you so much.

  • @mukeshnayal624
    @mukeshnayal624 Před rokem

    dill se thank you!

  • @sreevarshinirg4319
    @sreevarshinirg4319 Před 23 dny

    Understood, Tq for this great help by teaching in youtube for free

  • @harshilpatel3205
    @harshilpatel3205 Před 5 měsíci

    Amazing explanation sir 😇!

  • @sopparipraveen1212
    @sopparipraveen1212 Před rokem

    Great explanation

  • @mdsalimtauheedm-5810
    @mdsalimtauheedm-5810 Před 4 měsíci +1

    honestly I was very confused and demotivated after watching Rohit negi sir's explanation in paid course , i spent 2 hour to understand this problem but could not get it , after watching strivers explanation i get it only after single iteration. thanks a lot . now i am going to follow strivers AtoZ DSA

  • @AbhijeetMuneshwar
    @AbhijeetMuneshwar Před 2 měsíci

    Understood very well !!!

  • @AshishSharma-kg1yy
    @AshishSharma-kg1yy Před 19 dny

    woww what a great explanation

  • @sujalgupta6100
    @sujalgupta6100 Před 3 měsíci

    Finally understood this problem. Every time I saw rotated sorted array or binary search in general I always skipped.

  • @srutisingh4629
    @srutisingh4629 Před 8 měsíci +1

    Hats off to you❤

  • @user-rf7ri9pw9p
    @user-rf7ri9pw9p Před rokem +8

    Can anyone share the video link for peak element ?

  • @Musicuvakavi1823
    @Musicuvakavi1823 Před 3 měsíci

    Understood well thanks for this valuable video sir

  • @sandeeprajsaimon8600
    @sandeeprajsaimon8600 Před 25 dny

    best explanation ever

  • @yashraorane578
    @yashraorane578 Před 11 dny

    Best explanation💯

  • @bujagawnisaitejagoud2461
    @bujagawnisaitejagoud2461 Před 2 měsíci

    Very good explanation

  • @Raj-jw7kq
    @Raj-jw7kq Před 9 dny

    quality GOD LEVEL 🔥 🔥

  • @kingbadshah452
    @kingbadshah452 Před 6 měsíci

    thanks striver understood everything

  • @rahuljain224
    @rahuljain224 Před 2 měsíci

    Excellent explanation

  • @bhuoneparmar5098
    @bhuoneparmar5098 Před rokem

    understand bro !! keep uploading :)

  • @manavsingh5919
    @manavsingh5919 Před 11 měsíci

    Thank You Striver....Understood it

  • @Technocracy07
    @Technocracy07 Před 6 měsíci

    When we say that val @low < val @high means array is sorted, how about the case when the array is reverse sorted and rotated somewhere?

  • @user-cz4fw7ls8m
    @user-cz4fw7ls8m Před 2 měsíci

    Nice Explanation😄

  • @ankush8243
    @ankush8243 Před 4 měsíci

    Thank you so much!

  • @samuelfrank1369
    @samuelfrank1369 Před 9 měsíci

    Understood. Thanks a lot.

  • @anishasaini380
    @anishasaini380 Před 4 měsíci

    sir Best explanation Thanks!!

  • @nayanbramhane8077
    @nayanbramhane8077 Před 6 měsíci

    acche se samzaya, thanks

  • @ujjawalchourasiya3988
    @ujjawalchourasiya3988 Před 4 měsíci

    Love you bhaiya . You are my inspiration ❤

  • @shreyanshmittal9381
    @shreyanshmittal9381 Před 11 měsíci

    Understood bhaiya!

  • @Agustus1231
    @Agustus1231 Před 3 měsíci

    Very well Understood sir

  • @NazeerBashaShaik
    @NazeerBashaShaik Před 3 měsíci

    Understood, thank you.

  • @HarshSingh-nq4oe
    @HarshSingh-nq4oe Před 12 dny

    Understood
    Thank you.

  • @ashutoshranjan4644
    @ashutoshranjan4644 Před rokem

    You have perform binary search in sorted array ( keeping ascending order ) in mind. Am I right? This will not work if array is sorted ( can be in ascending /descending ) order ( not known before hand ). Correct me if I am wrong.

  • @ravindrasiddavatam1097
    @ravindrasiddavatam1097 Před 6 měsíci

    Good explanation

  • @SapnaSingh-rw1py
    @SapnaSingh-rw1py Před rokem +1

    Understood🙌

  • @roopeshdevapatiroopesh8388
    @roopeshdevapatiroopesh8388 Před 6 měsíci

    understood, thanks striver

  • @aaranyaksantra9933
    @aaranyaksantra9933 Před měsícem

    nice explanation

  • @infernogamer52
    @infernogamer52 Před rokem

    Understood Bhaiya!

  • @itzmartin20
    @itzmartin20 Před 9 měsíci

    UNDERSTOOD SIR!

  • @user-or5oz1pk2x
    @user-or5oz1pk2x Před 3 měsíci

    Thanks a lot Bhaiya

  • @artofwrick
    @artofwrick Před 9 měsíci

    Great, master ji.

  • @KEVALMEHTA-qe1ic
    @KEVALMEHTA-qe1ic Před 9 měsíci

    Good Explanation

  • @user-gm5fq4jg3m
    @user-gm5fq4jg3m Před rokem +1

    Understood sir ❤

  • @sajeedalreefy4713
    @sajeedalreefy4713 Před 7 měsíci

    Great Describing