solution for running time of insertion sort