stable_partition is a function template present in algorithm header file of c++ STL.
I read that it is an adaptive algorithm and its time complexity is O(n*logn) or O(n) dep
Exactly last-first applications of the predicate and at most
(last-first)*log(last-first) swaps if there is insufficient memory or
linear number of swaps if sufficient memory is available.