C# 顺序表操作
虽然.NET已经是现实了Reverse(),但是学习算法有必要知道其是怎么实现的:
private static void ReverseArray(int[] array) { int temp; int count = array.Length; for (int i = 0; i < count / 2; i++) { temp = array[count - 1 - i];//count-1:最大元素的索引 array[count - 1 - i] = array[i]; array[i] = temp; } }