Published on

[ Algorithm ] Quick Sort(퀵 정렬)

Authors
  • avatar
    Name
    유사공대생
    Twitter

Quick Sort

  • 평균 수행 시간: O(NlogN)
  • 최악 수행 시간: O(N^2)
  • 메모리(공간 복잡도): O(logN)
  • 안정성: X
public class BubbleSort {
    public static int[] bubbleSort(int[] arr) {
        for (int i = 0; i < arr.length - 1; i++) {
            for (int j = 0; j < arr.length -i-1; j++) {
                if (arr[j] > arr[j + 1]) {
                    int temp = arr[j];
                    arr[j] = arr[j+1];
                    arr[j+1] = temp;
                }
            }
        }
        return arr;
    }
}