Solve the runtime error in debug mode when It entered in partial_sort function.