Reverse an Array without using extra memory space(String reverse)

Поделиться
HTML-код
  • Опубликовано: 9 окт 2024
  • Reverse an Array without using extra memory space. The array can also be a string.We using swap operation here. The method is space efficient. The space complexity is O(N).

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

  • @deepnamdev5744
    @deepnamdev5744 2 года назад +1

    only teacher in RUclips ,who really started teaching in less than 7 seconds. Rest all waste 4-5 min for telling us to subscribe and like

  • @AbhinavKumar-dr4ef
    @AbhinavKumar-dr4ef 2 года назад

    Thank you. Simple and straight. God bless you for your work.

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

    Sir your videos are awesome. I have seen around 10 videos of yours as of now, you explain every thing very clearly and slowly and i find it very good and better than many famous channels. Kindly keep the good work

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

    Amazing videos. Your explanations are crystal clear. Another algorithm related to array rotation is block swapping, could you please make a video on that as the concept is slightly harder for newcomers to understand :) Your effort is much appreciated.

  • @JossinJax
    @JossinJax 5 лет назад +2

    I am still having trouble because I need to assign the value at a specific index to that temp value. But what method in java does that? chartAt and indexOf won't do it.

  • @naveenrapaka4236
    @naveenrapaka4236 20 дней назад

    Bayya, you are really rocking....should be in google or microsoft

  • @sanojkashyap6797
    @sanojkashyap6797 6 лет назад +3

    without using tmp how you can swap? it lost as soon as you swap first element to last element, you need to have last element somewhere?

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

      here the swap function has been kept abstract...it has the temp variable logic you are asking for

  • @biswaranjan3550
    @biswaranjan3550 7 лет назад +2

    hi sir good morning thanks for making such vedio on algorithm which helping us very much thanks for your effort I have one request could you please make an vedio on finding time complexity how to calculate it will be very helpful to us.Thanks

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

    Simply superb!! without wasting our time.. In a short time explained clearly

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

    please method video on array rotation by juggling method...especially the why we need to take LCM of the no of elements and no of shifts

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

    Hi,
    It was nice video.
    Could you please add a video about egg throwing algorithm to get floor no of the building.

  • @veera3844
    @veera3844 Год назад

    Amazing video sir yennakku python subject la arrays and method of array , function explain panugga sir

  • @fun-ih5sc
    @fun-ih5sc 4 года назад

    but sir you are not storing the resulted string any where.
    if you wanted to reverse the string(let say x="anything") and store that string in same variable (x = "gnihtyna") then through this process it can't be done.

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

    thank you from the cluster of 1337!

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

    Great teacher lovely video it helped me on my project thank you very much!!!

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

      kindly check the details

  • @jane7758
    @jane7758 5 лет назад +5

    I think you mean *decrement* e variable.

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

    Really nice and great explanation of all your ds and algorithms. I have learnt lot of logics and working flow from your session. Please make video for how to crack Google, Microsoft, Amazon interview. It would be great help.

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

    We will need a temp variable for swapping. However for positive numbers i guess we can use swap without temp variable, for example a=5 and b=8, then a=a+b, b= a-b, a=a-b will swap the numbers.

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

    thanks for that tutorial ..but please could you also teach how you can reverse a "hello world" so that it should look like "world hello" and explain step by step please hope you respond this request as fast as possible

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

    Hi, Bro nice explanation and nice teaching. Thank you for sharing your knowledge with us. We support you.

  • @Udaykumar-fo7yo
    @Udaykumar-fo7yo 7 лет назад

    Thank you for such valuable time.. could please upload on String permutations algorithm

  • @harshalchaudhari8137
    @harshalchaudhari8137 7 лет назад +7

    for swapping you need to use a temporary variable what about that extra memory?

    • @pankajkumar-oc2ed
      @pankajkumar-oc2ed 6 лет назад +1

      Harshal Chaudhari that will be very small Nazi. and you can swap without temp too

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

      hi ~ how to swap without temp?

    • @pankajkumar-oc2ed
      @pankajkumar-oc2ed 6 лет назад

      search on google

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

      yeah I know , thanks!

    • @hitec1691
      @hitec1691 5 лет назад +1

      If the extra memory being used is not growing with the sample size it is an in place algorithm

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

    what if we use for loop from size-1 and then print the elements??

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

    Well explained. worth watching

  • @gekk1985
    @gekk1985 Год назад

    end and start pointers are extra memory too!

  • @I-PixALbI4-I
    @I-PixALbI4-I 4 года назад

    I didn't understand how to write this code on C#... some help pls?

  • @AdityaKumar-ws5pv
    @AdityaKumar-ws5pv 7 лет назад

    Sir plz make more videos on question asked by product based company in placements.

  • @85Koshka
    @85Koshka 4 года назад

    Well explained! Thanks!

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

      kindly check the details

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

    Helpful vedeo sir 👍👍👍

  • @ron-e
    @ron-e 6 лет назад

    Sir, how it could be done without using swap() ?

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

      A temporary variable and "bubble sort"

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

    Super nicely explained..
    Sir..

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

    draw a flow diagram to input your name and print it in reverse

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

    did not mention s , e,n-1 ..which data type we taken

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

      It's not datatype, its variables you create. int s, int e

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

    I think without using extra memory you meant in-place algo. That would be the correct word to use here.

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

    more i see your videos more i love your teaching. create a patreon page

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

    i forgot to mention the program should be in c programming

  • @johnkamau3442
    @johnkamau3442 5 месяцев назад

    good job

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

    Amazing job bro

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

    What about odd number of elements?

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

      kindly check the details

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

    Awesome

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

    You are clearly using a temp variable. So your solution is pointless.
    however, one might use the following code to swap without a 3rd variable.
    assume a=5, b=10
    a=a+b //a=15, b=10
    b=a-b //a=15, b= 5
    a=a-b //a=10, b=5
    For characters, you can do it by converting the number into ASCII equivalent, and performing the same computation.

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

      a = a ^ b ^ (b = a) will do the swap without extra mem.

  • @rahulsingh-my3pu
    @rahulsingh-my3pu 6 лет назад

    Lot of loopholes are there

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

    Thankyou :)

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

      kindly check the details

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

    boss everything was going good but you ruin that at last by sayings friends. you are bro man

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

    sir did you have artificial intelengency plz up load video sir plz plz

  • @DhirajKumar-db5ol
    @DhirajKumar-db5ol 4 года назад +1

    Sir last me final coding v likhiye na 🙏🙏🙏🙏

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

      kindly check the details

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

    sir graph algorithm

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

      yes sure..sorry for late....i m trying to give the most time....

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

    nice accent!