Segregate positive and negative numbers in Array

Поділитися
Вставка
  • Опубліковано 23 січ 2025

КОМЕНТАРІ • 68

  • @arindamsamanta1207
    @arindamsamanta1207 6 років тому +35

    How does this preserve the original order among the negetive and positive numbers...That part is interesting.

  • @TheAbhinav375
    @TheAbhinav375 7 років тому +15

    sir,but the releative order of positive and negative number has changed.how can we maintain the order in which they appear

  • @vaibhavpal1655
    @vaibhavpal1655 3 роки тому

    Shri Radhe Radhe Ji 🙏🙏🙏 Jai Laddu Gopal Ji 🙏🙏🙏 Shri Kunj Bihari Ji 🙏🙏🙏 Shri Haridas Ji 🙏🙏🙏 Jai Ho Meri Priya Radhika Maai Ji 🙏🙏🙏

  • @mukeshm280
    @mukeshm280 3 роки тому +4

    To preserve the order, you can track the first swap index and from there reverse the values

  • @mrizigarouiass6474
    @mrizigarouiass6474 6 років тому +11

    Your output is missleading -1 -4 -6 -20 3 8 5 7 30 40 you didn't keep the order. So, your code will not keep the order. that is another problem that is more difficult.

  • @vaibhavpal1655
    @vaibhavpal1655 3 роки тому

    Shri Radhe Radhe Ji 🙏🙏🙏 Jai Ho Meri Priya Radhika Maii Ji 🙏🙏🙏

  • @45_ritiksharma32
    @45_ritiksharma32 4 роки тому +9

    Make a vidio on how to rearrange element negative and positive in alternative fadhion

  • @pradnyeshchoudhari9376
    @pradnyeshchoudhari9376 4 роки тому

    Great Explanation!! Got the thing very easily..

  • @sahulrajhansa8363
    @sahulrajhansa8363 7 років тому

    Who ever you are I have subscribed to your channel and you show some awesome algorithms, good job mate.

  • @srinidhiii
    @srinidhiii 7 років тому +1

    Please teach lot of problems in Arrays, I find recursion easy but array tough.
    Thanks a lot Again!!

  • @tridevthakur5397
    @tridevthakur5397 4 роки тому

    plz don't stop bro😊 keep on teaching us.

  • @akki4u
    @akki4u 6 років тому

    Your explanation is awesome. Thanks Bro!

  • @ramum5424
    @ramum5424 7 років тому +3

    sir but how to preserve the order of the elements??

  • @neerajmahapatra5239
    @neerajmahapatra5239 3 роки тому +2

    We can also use this instead of while(1) and check (l

  • @codewithharis
    @codewithharis 3 роки тому

    Bro please tell me if we want to sort this array in another array what will we do?????

  • @1USF
    @1USF 7 років тому

    please keep on making such videos, they are awsome. Thanks

  • @2708meghu
    @2708meghu 6 років тому +2

    Could you please explain to us the time complexity of this algorithm? as we see nested while loops

    • @TheAshishk007
      @TheAshishk007 4 роки тому +3

      Nested while loop does not increase the complexity as we are iterating each n element single time , so complexity is O(n).

  • @vivekchadha6971
    @vivekchadha6971 7 років тому +4

    if -1,2,3,-3 are in array then it will break without segerating the elements.

    • @BTechBackEndWala
      @BTechBackEndWala 2 роки тому

      No. It's work fine because first swap 2 and -3 and then break the loop.

  • @anshulsaini7440
    @anshulsaini7440 3 роки тому +1

    Thankyou sir 🙏

  • @crazyprograms6667
    @crazyprograms6667 6 років тому

    what happens when number '0' comes?

  • @utkarshsrivastava5003
    @utkarshsrivastava5003 3 роки тому

    code is giving segmentation fault..
    please sir is there any solution

  • @shankarmodi3469
    @shankarmodi3469 7 років тому +2

    Hi Vivekananda you are doing great work, If you can make videos on Graph and backtracking then I will be good for us , thanks

    • @vivekanandkhyade
      @vivekanandkhyade  7 років тому +1

      Yes I will make videos on Graph for sure.

    • @shankarmodi3469
      @shankarmodi3469 7 років тому +1

      Vivekanand Khyade - Algorithm Every Day thanks

  • @chandraprakashsingh1039
    @chandraprakashsingh1039 6 років тому +1

    but order is not same sir??

  • @kuldeepjindal4562
    @kuldeepjindal4562 6 років тому

    Thanks for such useful videos, request you to upload some videos on how to get time complexity/space complexity.

  • @abhisheksarkar3491
    @abhisheksarkar3491 5 років тому

    sir can't we just sort the array in ascending order

  • @diwakarmishra3909
    @diwakarmishra3909 7 років тому +2

    You havent preserved the order

  • @tushargoel5522
    @tushargoel5522 6 років тому +1

    you have not preserved order. You have shown different output.. should be corrected or change the subject line. its misleading and waste my time..

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

    the video was 5 years ago but still helps

  • @Ash888Mohd
    @Ash888Mohd 2 роки тому

    Im so sad 😞 I don’t know anything in math but I really want to , my problem is that I have to start from the beginning

  • @sarojsahoo8763
    @sarojsahoo8763 4 роки тому

    Just Arrays.sort(arr) will be enough

  • @Ankit13555
    @Ankit13555 7 років тому

    good explanation ,,,but plzz upload some complex questions....thanks for this vdo :)

  • @ramyaramar1234
    @ramyaramar1234 4 роки тому

    thanks sir
    Input A=[9,4,2,0,-1,-2,8,-4,3,10,-5]
    Output A=[10,9,8,4,-4,3,2,-2,0,-1,-5] plz explain the pogram

  • @ashishsinha8893
    @ashishsinha8893 7 років тому +1

    6. Given an array whose elements is monotonically increasing with both negative and positive
    numbers. Write an algorithm to find the point at which list becomes positive.
    7. Given a sorted array, find a given number. If found return the index if not, find the index of
    that number if it is inserted into the array.
    bro these are 2 problems can u give me video lecture in this problems

  • @DoubleTroubleStories
    @DoubleTroubleStories 7 років тому

    very informative and easy to understand

  • @apoorv1441
    @apoorv1441 2 роки тому

    Your answer changed the order

  • @shash207
    @shash207 7 років тому

    Vivek can you explain Manester algorithm for string search .

  • @firstname-ox2lw
    @firstname-ox2lw 7 років тому

    Can I apply quick sort??

    • @vivekanandkhyade
      @vivekanandkhyade  7 років тому +1

      That is O(n log n) for Quicksort.
      But we are doing it in o(n).

    • @firstname-ox2lw
      @firstname-ox2lw 7 років тому

      Vivekanand Khyade - Algorithm Every Day ...Yes sir.. Thank you so much

    • @firstname-ox2lw
      @firstname-ox2lw 7 років тому

      Vivekanand Khyade - Algorithm Every Day ... Can you please post a video regarding how to print a BST in vertical form

  • @shashankjha5318
    @shashankjha5318 4 роки тому

    thank you sir

  • @anupbisoyi
    @anupbisoyi 5 років тому

    Any way we can keep it in order .....

  • @heroparmar267
    @heroparmar267 5 років тому

    The program is wrong at the last I is greater then j so code will not execute

  • @roohuop
    @roohuop 4 роки тому

    it's using if condition not for..

  • @anupbisoyi
    @anupbisoyi 6 років тому

    Plz Add a video for segregation of linked list (even odd)

  • @mbawaters
    @mbawaters 5 років тому +1

    You did NOT maintain the order. You wasted my time.

  • @20092009ashish
    @20092009ashish 7 років тому +1

    Nice explanation. Thanks.

  • @srinidhiii
    @srinidhiii 7 років тому +2

    very good explanation sir

  • @murugananthama8318
    @murugananthama8318 5 років тому

    Sir can u plz upload the full program of this

  • @gireeshnaidu4599
    @gireeshnaidu4599 4 роки тому

    Explain this for 1 2 3 -8 -9 4

  • @aravindreddy1792
    @aravindreddy1792 3 роки тому

    Preserved original order in ex output
    But not while explaining :(

  • @rsoni7
    @rsoni7 7 років тому

    Great !!

  • @kushagrajaiswal358
    @kushagrajaiswal358 4 роки тому

    Bhai jab solved example me order maintain kia hai to code bhi order maintain rakhne vala batate...faltu time waste ho gya

  • @heisenberg.O_O
    @heisenberg.O_O 5 років тому

    We can also create a self balancing tree 👌

  • @PrinceKumar-hc6kh
    @PrinceKumar-hc6kh Рік тому

    Your method is totally wrong u don't maintain order

  • @suryapadala54
    @suryapadala54 4 роки тому

    U r telling very complex

  • @vaibhavpal1655
    @vaibhavpal1655 3 роки тому

    Shri Radhe Radhe Ji 🙏🙏🙏 Jai Ho Meri Priya Radhika Maai Ji 🙏🙏🙏

  • @vaibhavpal1655
    @vaibhavpal1655 3 роки тому

    Shri Radhe Radhe Ji 🙏🙏🙏 Jai Ho Meri Priya Radhika Maai Ji 🙏🙏🙏