I have an array that I want to sort based on the value of one of the values in the array. The way I want to sort it is to evenly distribute the value I am searching for throughout the resulting array. For example -
Original array = [a,b,c,d,1,2,3,4]
I want to achieve - [a,1,b,2,c,3,d,4]
I can work out when to insert the numbers (total items / no. of numbers) = 2 so every 2nd item should be a number.
What is the easiest and most efficient way to do this type of sorting?