Segregate positive and negative numbers in Array

Segregate positive and negative numbers in Array. Collect all the positive numbers and negative numbers together.

Пікірлер: 68

  • @arindamsamanta1207
    @arindamsamanta12076 жыл бұрын

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

  • @mukeshm280
    @mukeshm2802 жыл бұрын

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

  • @vaibhavpal1655
    @vaibhavpal16552 жыл бұрын

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

  • @TheAbhinav375
    @TheAbhinav3756 жыл бұрын

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

  • @pradnyeshchoudhari9376
    @pradnyeshchoudhari93764 жыл бұрын

    Great Explanation!! Got the thing very easily..

  • @mrizigarouiass6474
    @mrizigarouiass64746 жыл бұрын

    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.

  • @soumikdutta7867

    @soumikdutta7867

    3 жыл бұрын

    you are right

  • @sahulrajhansa8363
    @sahulrajhansa83636 жыл бұрын

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

  • @vaibhavpal1655
    @vaibhavpal16552 жыл бұрын

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

  • @akki4u
    @akki4u5 жыл бұрын

    Your explanation is awesome. Thanks Bro!

  • @45_ritiksharma32
    @45_ritiksharma324 жыл бұрын

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

  • @kuldeepjindal4562
    @kuldeepjindal45626 жыл бұрын

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

  • @1USF
    @1USF6 жыл бұрын

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

  • @tridevthakur5397
    @tridevthakur53974 жыл бұрын

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

  • @srinidhiii
    @srinidhiii6 жыл бұрын

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

  • @vivekanandkhyade

    @vivekanandkhyade

    6 жыл бұрын

    Yes Srinidhi. Sure.

  • @2708meghu
    @2708meghu5 жыл бұрын

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

  • @TheAshishk007

    @TheAshishk007

    4 жыл бұрын

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

  • @ramum5424
    @ramum54246 жыл бұрын

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

  • @logvedio
    @logvedio6 жыл бұрын

    Great !!

  • @tropabert4024
    @tropabert4024 Жыл бұрын

    the video was 5 years ago but still helps

  • @crazyprograms6667
    @crazyprograms66676 жыл бұрын

    what happens when number '0' comes?

  • @Ankit13555
    @Ankit135556 жыл бұрын

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

  • @apoorv1441
    @apoorv1441 Жыл бұрын

    Your answer changed the order

  • @anupbisoyi
    @anupbisoyi5 жыл бұрын

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

  • @codewithharis
    @codewithharis3 жыл бұрын

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

  • @neerajmahapatra5239
    @neerajmahapatra52393 жыл бұрын

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

  • @anshulsaini7440
    @anshulsaini74402 жыл бұрын

    Thankyou sir 🙏

  • @sarojsahoo8763
    @sarojsahoo87634 жыл бұрын

    Just Arrays.sort(arr) will be enough

  • @vivekchadha6971
    @vivekchadha69716 жыл бұрын

    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.

  • @shash207
    @shash2076 жыл бұрын

    Vivek can you explain Manester algorithm for string search .

  • @shankarmodi3469
    @shankarmodi34696 жыл бұрын

    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

    6 жыл бұрын

    Yes I will make videos on Graph for sure.

  • @shankarmodi3469

    @shankarmodi3469

    6 жыл бұрын

    Vivekanand Khyade - Algorithm Every Day thanks

  • @abhisheksarkar3491
    @abhisheksarkar34915 жыл бұрын

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

  • @20092009ashish
    @20092009ashish6 жыл бұрын

    Nice explanation. Thanks.

  • @DoubleTroubleStories
    @DoubleTroubleStories6 жыл бұрын

    very informative and easy to understand

  • @vivekanandkhyade

    @vivekanandkhyade

    6 жыл бұрын

    Thanks Aditya.

  • @chandraprakashsingh1039
    @chandraprakashsingh10396 жыл бұрын

    but order is not same sir??

  • @diwakarmishra3909
    @diwakarmishra39096 жыл бұрын

    You havent preserved the order

  • @roohuop
    @roohuop4 жыл бұрын

    it's using if condition not for..

  • @Ash888Mohd
    @Ash888Mohd Жыл бұрын

    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

  • @shashankjha5318
    @shashankjha53184 жыл бұрын

    thank you sir

  • @ramyaramar1234
    @ramyaramar12343 жыл бұрын

    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

  • @firstname-ox2lw
    @firstname-ox2lw6 жыл бұрын

    Can I apply quick sort??

  • @vivekanandkhyade

    @vivekanandkhyade

    6 жыл бұрын

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

  • @firstname-ox2lw

    @firstname-ox2lw

    6 жыл бұрын

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

  • @firstname-ox2lw

    @firstname-ox2lw

    6 жыл бұрын

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

  • @srinidhiii
    @srinidhiii6 жыл бұрын

    very good explanation sir

  • @gireeshnaidu4599
    @gireeshnaidu45994 жыл бұрын

    Explain this for 1 2 3 -8 -9 4

  • @anupbisoyi
    @anupbisoyi4 жыл бұрын

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

  • @utkarshsrivastava5003
    @utkarshsrivastava50033 жыл бұрын

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

  • @murugananthama8318
    @murugananthama83185 жыл бұрын

    Sir can u plz upload the full program of this

  • @heisenberg.O_O
    @heisenberg.O_O5 жыл бұрын

    We can also create a self balancing tree 👌

  • @ashishsinha8893
    @ashishsinha88936 жыл бұрын

    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

  • @aravindreddy1792
    @aravindreddy17922 жыл бұрын

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

  • @heroparmar267
    @heroparmar2675 жыл бұрын

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

  • @tushargoel5522
    @tushargoel55225 жыл бұрын

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

  • @mbawaters
    @mbawaters5 жыл бұрын

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

  • @suryapadala54
    @suryapadala544 жыл бұрын

    U r telling very complex

  • @kushagrajaiswal358
    @kushagrajaiswal3583 жыл бұрын

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

  • @PrinceKumar-hc6kh
    @PrinceKumar-hc6kh9 ай бұрын

    Your method is totally wrong u don't maintain order

  • @vaibhavpal1655
    @vaibhavpal16552 жыл бұрын

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

  • @vaibhavpal1655
    @vaibhavpal16552 жыл бұрын

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