最新的.Net面试题及答案
发布时间:2021-06-11
发布时间:2021-06-11
最新的.Net面试题及答案
最新的.Net面试题及答案
1.a=10,b=15,在不用第三方变题的前提下,把a,b的值互换
a=a+b;b=a-b;a=(a-b)/2;b=b+a
2:已知数组int[] max={6,5,2,9,7,4,0};用快速排序算法按降序对其进行排列,并返回数组
public class TestQuickSort {
private int[] array = null;
private void quickSort(int lowest, int highest) {
if (array == null || lowest < 0 || lowest >= highest
|| highest >= array.length) {
return;
}
int low = lowest;
int high = highest;
int key = low++;
for (; low <= high;) {
if (key < high) {
if (array[key] > array[high]) {
array[high] = array[key] + (array[key] = array[high]) * 0; key = high;
}