array complexity algorithms

The find_index method and array.min calls here, while helpful, will actually slow down the algorithm. Instead of traversing the array once, you are traversing it twice. Try rewriting the algorithm to use a .each_index instead.