I want an efficient sorting algorithm to sort an array
问题 for (int i = 1; i < data.Count; i++) { int j = i; while (j > 0) { if (numarray[j - 1] > numarray[j]) { int temp = numarray[j - 1]; numarray[j - 1] = numarray[j]; numarray[j] = temp; j--; } else break; } } Can someone help me identify what is the sorting algorithm of the above code? I know that bubble sort is not very efficient. If I am to use insertion sort algorithm instead, how can I improve the above code. Thankyou! 回答1: Just do this: Array.Sort(data); 回答2: the most efficient way should be