Segregate positive and negative numbers in Array. Collect all the positive numbers and negative numbers together.
Жүктеу.....
Пікірлер: 68
@arindamsamanta12076 жыл бұрын
How does this preserve the original order among the negetive and positive numbers...That part is interesting.
@mukeshm2802 жыл бұрын
To preserve the order, you can track the first swap index and from there reverse the values
@vaibhavpal16552 жыл бұрын
Shri Radhe Radhe Ji 🙏🙏🙏 Jai Ho Meri Priya Radhika Maai Ji 🙏🙏🙏
@TheAbhinav3756 жыл бұрын
sir,but the releative order of positive and negative number has changed.how can we maintain the order in which they appear
@pradnyeshchoudhari93764 жыл бұрын
Great Explanation!! Got the thing very easily..
@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
3 жыл бұрын
you are right
@sahulrajhansa83636 жыл бұрын
Who ever you are I have subscribed to your channel and you show some awesome algorithms, good job mate.
@vaibhavpal16552 жыл бұрын
Shri Radhe Radhe Ji 🙏🙏🙏 Jai Laddu Gopal Ji 🙏🙏🙏 Shri Kunj Bihari Ji 🙏🙏🙏 Shri Haridas Ji 🙏🙏🙏 Jai Ho Meri Priya Radhika Maai Ji 🙏🙏🙏
@akki4u5 жыл бұрын
Your explanation is awesome. Thanks Bro!
@45_ritiksharma324 жыл бұрын
Make a vidio on how to rearrange element negative and positive in alternative fadhion
@kuldeepjindal45626 жыл бұрын
Thanks for such useful videos, request you to upload some videos on how to get time complexity/space complexity.
@1USF6 жыл бұрын
please keep on making such videos, they are awsome. Thanks
@tridevthakur53974 жыл бұрын
plz don't stop bro😊 keep on teaching us.
@srinidhiii6 жыл бұрын
Please teach lot of problems in Arrays, I find recursion easy but array tough. Thanks a lot Again!!
@vivekanandkhyade
6 жыл бұрын
Yes Srinidhi. Sure.
@2708meghu5 жыл бұрын
Could you please explain to us the time complexity of this algorithm? as we see nested while loops
@TheAshishk007
4 жыл бұрын
Nested while loop does not increase the complexity as we are iterating each n element single time , so complexity is O(n).
@ramum54246 жыл бұрын
sir but how to preserve the order of the elements??
@logvedio6 жыл бұрын
Great !!
@tropabert4024 Жыл бұрын
the video was 5 years ago but still helps
@crazyprograms66676 жыл бұрын
what happens when number '0' comes?
@Ankit135556 жыл бұрын
good explanation ,,,but plzz upload some complex questions....thanks for this vdo :)
@apoorv1441 Жыл бұрын
Your answer changed the order
@anupbisoyi5 жыл бұрын
Plz Add a video for segregation of linked list (even odd)
@codewithharis3 жыл бұрын
Bro please tell me if we want to sort this array in another array what will we do?????
@neerajmahapatra52393 жыл бұрын
We can also use this instead of while(1) and check (l
@anshulsaini74402 жыл бұрын
Thankyou sir 🙏
@sarojsahoo87634 жыл бұрын
Just Arrays.sort(arr) will be enough
@vivekchadha69716 жыл бұрын
if -1,2,3,-3 are in array then it will break without segerating the elements.
@BTechBackEndWala
2 жыл бұрын
No. It's work fine because first swap 2 and -3 and then break the loop.
@shash2076 жыл бұрын
Vivek can you explain Manester algorithm for string search .
@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
6 жыл бұрын
Yes I will make videos on Graph for sure.
@shankarmodi3469
6 жыл бұрын
Vivekanand Khyade - Algorithm Every Day thanks
@abhisheksarkar34915 жыл бұрын
sir can't we just sort the array in ascending order
@20092009ashish6 жыл бұрын
Nice explanation. Thanks.
@DoubleTroubleStories6 жыл бұрын
very informative and easy to understand
@vivekanandkhyade
6 жыл бұрын
Thanks Aditya.
@chandraprakashsingh10396 жыл бұрын
but order is not same sir??
@diwakarmishra39096 жыл бұрын
You havent preserved the order
@roohuop4 жыл бұрын
it's using if condition not for..
@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
@shashankjha53184 жыл бұрын
thank you sir
@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-ox2lw6 жыл бұрын
Can I apply quick sort??
@vivekanandkhyade
6 жыл бұрын
That is O(n log n) for Quicksort. But we are doing it in o(n).
@firstname-ox2lw
6 жыл бұрын
Vivekanand Khyade - Algorithm Every Day ...Yes sir.. Thank you so much
@firstname-ox2lw
6 жыл бұрын
Vivekanand Khyade - Algorithm Every Day ... Can you please post a video regarding how to print a BST in vertical form
@srinidhiii6 жыл бұрын
very good explanation sir
@gireeshnaidu45994 жыл бұрын
Explain this for 1 2 3 -8 -9 4
@anupbisoyi4 жыл бұрын
Any way we can keep it in order .....
@utkarshsrivastava50033 жыл бұрын
code is giving segmentation fault.. please sir is there any solution
@murugananthama83185 жыл бұрын
Sir can u plz upload the full program of this
@heisenberg.O_O5 жыл бұрын
We can also create a self balancing tree 👌
@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
@aravindreddy17922 жыл бұрын
Preserved original order in ex output But not while explaining :(
@heroparmar2675 жыл бұрын
The program is wrong at the last I is greater then j so code will not execute
@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..
@mbawaters5 жыл бұрын
You did NOT maintain the order. You wasted my time.
@suryapadala544 жыл бұрын
U r telling very complex
@kushagrajaiswal3583 жыл бұрын
Bhai jab solved example me order maintain kia hai to code bhi order maintain rakhne vala batate...faltu time waste ho gya
@PrinceKumar-hc6kh9 ай бұрын
Your method is totally wrong u don't maintain order
@vaibhavpal16552 жыл бұрын
Shri Radhe Radhe Ji 🙏🙏🙏 Jai Ho Meri Priya Radhika Maai Ji 🙏🙏🙏
@vaibhavpal16552 жыл бұрын
Shri Radhe Radhe Ji 🙏🙏🙏 Jai Ho Meri Priya Radhika Maii Ji 🙏🙏🙏
Пікірлер: 68
How does this preserve the original order among the negetive and positive numbers...That part is interesting.
To preserve the order, you can track the first swap index and from there reverse the values
Shri Radhe Radhe Ji 🙏🙏🙏 Jai Ho Meri Priya Radhika Maai Ji 🙏🙏🙏
sir,but the releative order of positive and negative number has changed.how can we maintain the order in which they appear
Great Explanation!! Got the thing very easily..
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
3 жыл бұрын
you are right
Who ever you are I have subscribed to your channel and you show some awesome algorithms, good job mate.
Shri Radhe Radhe Ji 🙏🙏🙏 Jai Laddu Gopal Ji 🙏🙏🙏 Shri Kunj Bihari Ji 🙏🙏🙏 Shri Haridas Ji 🙏🙏🙏 Jai Ho Meri Priya Radhika Maai Ji 🙏🙏🙏
Your explanation is awesome. Thanks Bro!
Make a vidio on how to rearrange element negative and positive in alternative fadhion
Thanks for such useful videos, request you to upload some videos on how to get time complexity/space complexity.
please keep on making such videos, they are awsome. Thanks
plz don't stop bro😊 keep on teaching us.
Please teach lot of problems in Arrays, I find recursion easy but array tough. Thanks a lot Again!!
@vivekanandkhyade
6 жыл бұрын
Yes Srinidhi. Sure.
Could you please explain to us the time complexity of this algorithm? as we see nested while loops
@TheAshishk007
4 жыл бұрын
Nested while loop does not increase the complexity as we are iterating each n element single time , so complexity is O(n).
sir but how to preserve the order of the elements??
Great !!
the video was 5 years ago but still helps
what happens when number '0' comes?
good explanation ,,,but plzz upload some complex questions....thanks for this vdo :)
Your answer changed the order
Plz Add a video for segregation of linked list (even odd)
Bro please tell me if we want to sort this array in another array what will we do?????
We can also use this instead of while(1) and check (l
Thankyou sir 🙏
Just Arrays.sort(arr) will be enough
if -1,2,3,-3 are in array then it will break without segerating the elements.
@BTechBackEndWala
2 жыл бұрын
No. It's work fine because first swap 2 and -3 and then break the loop.
Vivek can you explain Manester algorithm for string search .
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
6 жыл бұрын
Yes I will make videos on Graph for sure.
@shankarmodi3469
6 жыл бұрын
Vivekanand Khyade - Algorithm Every Day thanks
sir can't we just sort the array in ascending order
Nice explanation. Thanks.
very informative and easy to understand
@vivekanandkhyade
6 жыл бұрын
Thanks Aditya.
but order is not same sir??
You havent preserved the order
it's using if condition not for..
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
thank you sir
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
Can I apply quick sort??
@vivekanandkhyade
6 жыл бұрын
That is O(n log n) for Quicksort. But we are doing it in o(n).
@firstname-ox2lw
6 жыл бұрын
Vivekanand Khyade - Algorithm Every Day ...Yes sir.. Thank you so much
@firstname-ox2lw
6 жыл бұрын
Vivekanand Khyade - Algorithm Every Day ... Can you please post a video regarding how to print a BST in vertical form
very good explanation sir
Explain this for 1 2 3 -8 -9 4
Any way we can keep it in order .....
code is giving segmentation fault.. please sir is there any solution
Sir can u plz upload the full program of this
We can also create a self balancing tree 👌
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
Preserved original order in ex output But not while explaining :(
The program is wrong at the last I is greater then j so code will not execute
you have not preserved order. You have shown different output.. should be corrected or change the subject line. its misleading and waste my time..
You did NOT maintain the order. You wasted my time.
U r telling very complex
Bhai jab solved example me order maintain kia hai to code bhi order maintain rakhne vala batate...faltu time waste ho gya
Your method is totally wrong u don't maintain order
Shri Radhe Radhe Ji 🙏🙏🙏 Jai Ho Meri Priya Radhika Maai Ji 🙏🙏🙏
Shri Radhe Radhe Ji 🙏🙏🙏 Jai Ho Meri Priya Radhika Maii Ji 🙏🙏🙏