Array - Rotation using C++

Поделиться
HTML-код
  • Опубликовано: 6 ноя 2024

Комментарии • 50

  • @codewhoop
    @codewhoop  7 лет назад

    Website Link: www.codewhoop.com/array/rotation.html
    Support Us: www.patreon.com/codewhoop

  • @disenchantedcardgd9878
    @disenchantedcardgd9878 3 года назад +6

    may someone explain the logic behind this? ye okey it works for values cool, but how does one come up with this?

  • @Muskan-DataNaari
    @Muskan-DataNaari 3 года назад +1

    Great explanation, made it very clear! thank you :)

  • @saimadib
    @saimadib 2 года назад

    Bruh very awesome how have you think of these algorithm in new temp array?

  • @grin09
    @grin09 2 года назад

    Is the program of left and right are same?

  • @unknown_rude744
    @unknown_rude744 3 года назад

    Very nice and simple concept

  • @OmKumar-js7jd
    @OmKumar-js7jd 4 года назад +1

    Fantastic presentation ❤️

  • @ShivamGupta-ou1lx
    @ShivamGupta-ou1lx 3 года назад

    Great explanation🔥

  • @abhiG_
    @abhiG_ 6 лет назад

    Great man u must have given a lot of thought to create that formula

  • @muhammadsaim403
    @muhammadsaim403 2 года назад

    Please Sir
    Start making videos regularly

  • @mohitarya5189
    @mohitarya5189 4 года назад

    tremendous bro

  • @glennmathewgarma8565
    @glennmathewgarma8565 5 лет назад

    Nice tutorial! Thanks!

  • @ketkisingh5504
    @ketkisingh5504 3 года назад

    thanks a lot :)

  • @BladeAndrade
    @BladeAndrade 6 лет назад +2

    what is the formula for left rotation?

    • @abhishekpanda3400
      @abhishekpanda3400 4 года назад

      arr[i] = arr[(i+N-k)%N]

    • @rajdeepkundu5107
      @rajdeepkundu5107 3 года назад

      @@abhishekpanda3400 the formula you gave above is for right rotation. In this video he actually explains left rotation.

  • @quranosunnattv3714
    @quranosunnattv3714 4 года назад

    Thank you sooo much dude

  • @Deepakkumar-is5ee
    @Deepakkumar-is5ee 5 лет назад

    Great brother 👍🏻

  • @rahulagarwal8059
    @rahulagarwal8059 4 года назад

    Nice

  • @rajdeepkundu5107
    @rajdeepkundu5107 3 года назад +2

    This is left rotation and not right rotation. Since you are using an array of size 4 so it seems the same thing here. Try for larger array size and see that this is the concept for left rotation.
    For right rotation: arr[i] = arr[(i+N-k)%N] , k = no. of rotations; N = array size
    Request you to please upload the video again otherwise it will confuse students.

    • @kothekarswaraj
      @kothekarswaraj 3 года назад

      ya but this can also be called as right shifting of array elements

  • @abhinashbihari2881
    @abhinashbihari2881 4 года назад +2

    But this is not optimised solution.In this case Time complexity will be O(n*k) but for optimised solution time complexity will be O(n)

    • @ameygadhe6437
      @ameygadhe6437 2 года назад

      bro use the rotate function it has time complexity of o(n)

  • @animeprofiles2077
    @animeprofiles2077 6 лет назад +1

    How about to the left

  • @GuyKroizman
    @GuyKroizman 6 лет назад +2

    There is already a standard function in C++ which does rotate.

  • @musicislife1844
    @musicislife1844 6 лет назад

    thank you very much

  • @563woodcock
    @563woodcock 7 лет назад

    very good video sir

  • @johnmathai2611
    @johnmathai2611 7 лет назад

    Nice tut +1

  • @divyanshrawat2859
    @divyanshrawat2859 2 года назад

    Anyone its time and space complexity please ?

  • @shahrukh631
    @shahrukh631 7 лет назад +1

    Is this even allowed B[n] ? :/

  • @2aMaK
    @2aMaK 7 лет назад

    Could you please do one with in-place k rotation?

    • @codewhoop
      @codewhoop  7 лет назад

      Sure !! will work on it soon :)

    • @codewhoop
      @codewhoop  7 лет назад

      There you go :) www.codewhoop.com/tutorial/array-rotation-in-place

    • @2aMaK
      @2aMaK 7 лет назад

      THANK YOU!

    • @johnliu8715
      @johnliu8715 7 лет назад

      What is the difference between this video and the in-place k rotation?

    • @codewhoop
      @codewhoop  7 лет назад

      method in this video has space complexity of O(n) as we are using another array of the same size.

  • @prabhuchopra9266
    @prabhuchopra9266 6 лет назад

    formula for left rotation?

  • @AjinkyaBobadepictpune
    @AjinkyaBobadepictpune 7 лет назад

    nice

  • @yazanhassan9350
    @yazanhassan9350 7 лет назад

    Nice Nice Nice Nice Nice Nice Nice Nice :)

  • @ahmadr299
    @ahmadr299 5 лет назад

    I want a code