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

Поділитися
Вставка
  • Опубліковано 1 гру 2024

КОМЕНТАРІ • 468

  • @takeUforward
    @takeUforward  Рік тому +144

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

  • @chaudharyalisha7175
    @chaudharyalisha7175 Рік тому +28

    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!!

  • @yash-seth
    @yash-seth Рік тому +38

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

  • @hilal937
    @hilal937 Рік тому +10

    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

  • @abhisheksinghmehra9576
    @abhisheksinghmehra9576 Рік тому +195

    We never move backward bcoz we have Take You Forward😇

  • @mehulthuletiya497
    @mehulthuletiya497 Рік тому +39

    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

  • @junaidahmed3615
    @junaidahmed3615 Рік тому +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

  • @monstercoder3665
    @monstercoder3665 Рік тому +73

    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 Рік тому +3

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

    • @shubhamkumar-hx1fb
      @shubhamkumar-hx1fb Рік тому

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

  • @lofireverbz-wy7go
    @lofireverbz-wy7go Рік тому +57

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

    • @yoongicorn7973
      @yoongicorn7973 Рік тому +11

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

    • @lofireverbz-wy7go
      @lofireverbz-wy7go Рік тому

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

    • @shivanipatwa4709
      @shivanipatwa4709 3 місяці тому +3

      yk striver is a cutie....😉😉

    • @Akshitrawat121
      @Akshitrawat121 2 місяці тому +2

      Mujhe mera mele m khoya hua bhai mil gya because our thoughts are same 🤣

    • @anishaa3298
      @anishaa3298 8 днів тому

      got a little distracted. hehe

  • @reyanshmishra7676
    @reyanshmishra7676 Рік тому +18

    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.

    • @alwinsanthosh6878
      @alwinsanthosh6878 2 місяці тому

      Ig after solving like 15 BS problems, that's somewhat how all BS qs probably are.
      Divide search space into two halves
      Use some condition to eliminate either of the half from the search space

  • @beingproductive22
    @beingproductive22 10 місяців тому +9

    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 4 місяці тому +1

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

    • @sarveshkulkarni6287
      @sarveshkulkarni6287 3 місяці тому

      Yep that's not intuitive as this the striver's approach is

  • @sergion_brayen
    @sergion_brayen 8 місяців тому +3

    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

  • @ML-ok9nf
    @ML-ok9nf Рік тому +2

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

  • @knownforunknowns
    @knownforunknowns Місяць тому +1

    The one who are selling just their courses and making abundant money are getting more and more fame and heavily recognised today, but the person who truly creating impact is just not even known by everyone today, But anyway thank u so much striver bhaiya , for this great quality content , i wish you will be respected by every cs student of india one day !!

  • @unknown2003august
    @unknown2003august 5 місяців тому +3

    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

  • @pratikkumarsingh8114
    @pratikkumarsingh8114 Рік тому +2

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

  • @venkatsaireddy1412
    @venkatsaireddy1412 10 місяців тому +1

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

  • @junaiid0104
    @junaiid0104 4 місяці тому +1

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

  • @VasanthChoudary-uc5cz
    @VasanthChoudary-uc5cz Рік тому +2

    Thankyou for providing this course for free bro.

  • @adarshmv261
    @adarshmv261 7 місяців тому

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

  • @rrt19254
    @rrt19254 2 місяці тому

    Understood! This man is a legend...

  • @cinime
    @cinime Рік тому +2

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

  • @ishangujarathi10
    @ishangujarathi10 Рік тому +1

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

  • @seeingsee6593
    @seeingsee6593 Місяць тому

    you are the best teacher I finally understood this problem thank you so much

  • @hrishii.02
    @hrishii.02 5 місяців тому

    Understood! What a simple and affective explaination

  • @mriit3025
    @mriit3025 7 місяців тому

    best possible understanding through the BS playlist!

  • @swathigp3818
    @swathigp3818 8 місяців тому

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

  • @kaushiksen2190
    @kaushiksen2190 Рік тому +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

  • @prathamrawat6298
    @prathamrawat6298 5 місяців тому

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

  • @HarshSingh-hk8fe
    @HarshSingh-hk8fe 11 місяців тому

    bro the way you explain is just amazing thanks a lot

  • @nagame859
    @nagame859 Рік тому

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

  • @sreevarshinirg4319
    @sreevarshinirg4319 4 місяці тому

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

  • @NeerajKar-i7r
    @NeerajKar-i7r Рік тому +2

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

  • @kumpatisupriya3947
    @kumpatisupriya3947 Рік тому

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

  • @PeterParker-ee6ep
    @PeterParker-ee6ep Рік тому +1

    everyone just try dry run after you complete video after your understanding, it really in understanding still better. try ittt

  • @revanthkumar5417
    @revanthkumar5417 Рік тому

    Best explanation so far in binary search

  • @sujalgupta6100
    @sujalgupta6100 7 місяців тому

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

  • @Fe-ironman
    @Fe-ironman Місяць тому

    what i did was i found the starting point using similar approach of binary search then applied binary search from that point...but this approach is goated

  • @anddevsahil
    @anddevsahil 8 місяців тому +1

    Can't find better explanation than striver .

  • @k.satish3663
    @k.satish3663 Рік тому

    Totally understood.your teaching is superb.thank you

  • @abhimanyuambastha2595
    @abhimanyuambastha2595 9 місяців тому +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

  • @prernagupta7450
    @prernagupta7450 9 місяців тому

    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

  • @hareshnayak7302
    @hareshnayak7302 8 місяців тому

    Understood,Thanks stiver for this amazing video.

  • @Raj_singhh
    @Raj_singhh 4 місяці тому

    quality GOD LEVEL 🔥 🔥

  • @radha7492
    @radha7492 Рік тому +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 9 місяців тому

    This is the best explanation

  • @UserUser-tn8tv
    @UserUser-tn8tv 10 місяців тому

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

  • @rakshitraushan1650
    @rakshitraushan1650 9 місяців тому

    Understood bro!! Ur a gem!

  • @somu7441
    @somu7441 2 місяці тому

    Only because of you I am loving DSA

  • @venkatesasrikanthdhulipala9486

    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

    • @sarveshkulkarni6287
      @sarveshkulkarni6287 3 місяці тому

      No wrong, let me proove , low = 0 , high = 1 , mid = 0 , Now check if arr[low]

  • @sandeeprajsaimon8600
    @sandeeprajsaimon8600 5 місяців тому

    best explanation ever

  • @Akshitrawat121
    @Akshitrawat121 2 місяці тому

    9:58 what a expression ;) mtlb mza sa aagya😆

  • @srutisingh4629
    @srutisingh4629 Рік тому +1

    Hats off to you❤

  • @AtulKumar-c4x7l
    @AtulKumar-c4x7l Рік тому

    understood
    Thank you striver for making things easy...

  • @ADITYASRIVASTAVABCE
    @ADITYASRIVASTAVABCE Рік тому

    Thankyou for clear explanation. Loved it.

  • @fastlaner7746
    @fastlaner7746 3 місяці тому

    "Identify the sorted half" thank you

  • @rtheame4704
    @rtheame4704 6 місяців тому

    Very well explained 👏🏻👏🏻

  • @sanchisingh5117
    @sanchisingh5117 Рік тому

    striver's explanations are the best

  • @vinitverma1741
    @vinitverma1741 Рік тому +1

    Thank u for such a great explaination

  • @rajkumarvb5197
    @rajkumarvb5197 Рік тому

    Understood, thanks for your efforts!

  • @myproject6768
    @myproject6768 Рік тому +1

    Absolutely understand ❤

  • @ujjawalchourasiya3988
    @ujjawalchourasiya3988 9 місяців тому

    Love you bhaiya . You are my inspiration ❤

  • @yashraj5898
    @yashraj5898 25 днів тому

    great explanation buddy !

  • @yashraorane578
    @yashraorane578 4 місяці тому

    Best explanation💯

  • @AshishSharma-kg1yy
    @AshishSharma-kg1yy 4 місяці тому

    woww what a great explanation

  • @DevanshiKapla
    @DevanshiKapla Рік тому +9

    Can anyone share the video link for peak element ?

  • @SameerSuman-ni6fz
    @SameerSuman-ni6fz 2 місяці тому

    Elimination is key - GOLDEN WORDS

  • @ayushichoudhary1019
    @ayushichoudhary1019 Рік тому

    Best Explanation!

  • @harshilpatel3205
    @harshilpatel3205 10 місяців тому

    Amazing explanation sir 😇!

  • @akaashk623
    @akaashk623 Рік тому

    Greatly explained 👏👏

  • @SapnaSingh-rw1py
    @SapnaSingh-rw1py Рік тому +1

    Understood🙌

  • @Musicuvakavi1823
    @Musicuvakavi1823 8 місяців тому

    Understood well thanks for this valuable video sir

  • @neerajpruthi8350
    @neerajpruthi8350 9 місяців тому

    Love the explanation. THanks

  • @Abhishekkumarnjw22-vf7cr
    @Abhishekkumarnjw22-vf7cr 4 місяці тому

    Great help you are doing

  • @AkhileshChouhan-d4v
    @AkhileshChouhan-d4v 5 місяців тому

    Great explanation.

  • @jaydevkundu554
    @jaydevkundu554 Рік тому

    UNDERSTOOD Striver Op🔥🔥

  • @nikhilkumarjamwal5322
    @nikhilkumarjamwal5322 Рік тому

    Nice Explanation!👍

  • @jayantmishra2266
    @jayantmishra2266 Рік тому +2

    1 QUESTION : will this approach/code work in the case of left rotated array also?? bacause here you explained for right rotated example.

    • @abhaymandal4903
      @abhaymandal4903 Рік тому

      Yes , same code will be there for left rotared.

  • @qihse1531
    @qihse1531 Рік тому +2

    Any thoughts on this corner case not passing: ARR=[3,1], target:1, Why is that? How to generalize the solution?

    • @qihse1531
      @qihse1531 Рік тому

      Other than that, beautiful explanation charm💯💯

  • @anishasaini380
    @anishasaini380 8 місяців тому

    sir Best explanation Thanks!!

  • @mukeshnayal624
    @mukeshnayal624 Рік тому

    dill se thank you!

  • @rashmirsd
    @rashmirsd Рік тому

    Very nice explanation. Thank you

  • @mathialagant
    @mathialagant 10 місяців тому

    9:56
    Perfect reaction 😂

  • @manishdhekane5393
    @manishdhekane5393 Рік тому

    Understood very well !

  • @BalajiG-ms3vu
    @BalajiG-ms3vu 7 місяців тому

    Understood bro,thank you so much.

  • @apmotivationakashparmar722
    @apmotivationakashparmar722 9 місяців тому

    Great Explaination

  • @kushagramishra5638
    @kushagramishra5638 Рік тому +1

    Understood!

  • @VikasBagri-i5j
    @VikasBagri-i5j Рік тому

    Understood it very well :)

  • @SagarKumar-li4um
    @SagarKumar-li4um 2 місяці тому +1

    understood sir

  • @UjvalGupta-l1e
    @UjvalGupta-l1e Рік тому +1

    Understood sir ❤

  • @itzmartin20
    @itzmartin20 Рік тому

    UNDERSTOOD SIR!

  • @saketjaiswalSJ
    @saketjaiswalSJ Рік тому

    9:57 sir is so much excited

  • @bujagawnisaitejagoud2461
    @bujagawnisaitejagoud2461 6 місяців тому

    Very good explanation

  • @manavsingh5919
    @manavsingh5919 Рік тому

    Thank You Striver....Understood it

  • @infernogamer52
    @infernogamer52 Рік тому

    Understood Bhaiya!

  • @Technocracy07
    @Technocracy07 10 місяців тому

    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?

  • @OG_241
    @OG_241 6 місяців тому

    Nice Explanation😄

  • @tanishkthakur9965
    @tanishkthakur9965 6 місяців тому +1

    understood

  • @YourCodeVerse
    @YourCodeVerse 11 місяців тому

    Understood✅🔥🔥

  • @artofwrick
    @artofwrick Рік тому

    Great, master ji.