Write A C++ Function To Shift The Negative Numbers To Left And The Positive Numbers To The Right Of An Array Of Numbers. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Write A C++ Function To Shift The Negative Numbers To Left And The Positive Numbers To The Right Of An Array Of Numbers.

Eg: if array is -1 0 7 -7 8 -2 output should be -1 -7 -2 0 7 8

25th Feb 2017, 5:02 AM
Soutik
Soutik - avatar
1 Answer
+ 2
you could just sort it... this would make it -7 -2 -1 0 7 8 but still. there are ALOT of something algorithms out there...
25th Feb 2017, 6:16 AM
Michael Szczepanski
Michael Szczepanski - avatar