If your "array" is actually a skip-list , this can be done inO(log(n)sqrt(n))
for each element x in reminder:
remove x from skip list (O(1))
find first element smaller then x in sorted part (O(logn))
insert x to the found position (O(1))
complexity will be sqrt(n)*log(n)
, , ( , ), O(n), , O(n)