Algorithms: In-place algorithm to rearrange elements of an array

C++In a given array of elements like
[a1, a2, ..., an, b1, b2, ..., bn, <X>1,<X>2, ..., <X>n]

without taking a extra memory swap elements in the array so the outcome will be like
[a1, b1, … <X>1, a2, b2, … <X>2, …, an, bn, …, <X>n] Continue reading