java面试笔试冒泡排和快速排序

public static void 冒泡sort(int[] arr) {
		int[] list = { 1, 0, 2, 9, 4, 6, 3 };
		Boolean boo = true;

		for (int i = 1; i < list.length && boo; i++) {
			boo = false;
			for (int k = 0; k < list.length - i; k++) {
				if (list[k] > list[k + 1]) {
					int temp = list[k];
					list[k] = list[k + 1];
					list[k + 1] = temp;
				}
			}
		}

	}
public static List quicksort(List number){
		if(number.size()<2){
			return number;
		}
		
		final Integer piovt=number.get(0);
		final List lower = new ArrayList<>();
	    final List higher = new ArrayList<>();
		
	    for(int i=1;i sorted=quicksort(lower);
	    
	    sorted.add(piovt);
	    sorted.addAll(quicksort(higher));
	    
			return sorted;
	}

 
 

你可能感兴趣的:(java面试)