📜  快速排序 java 代码示例

📅  最后修改于: 2022-03-11 14:52:16.035000             🧑  作者: Mango

代码示例2
public static ArrayList quickSort(ArrayList list)
{
    if (list.isEmpty()) 
        return list; // start with recursion base case
    ArrayList sorted;  // this shall be the sorted list to return, no needd to initialise
    ArrayList smaller = new ArrayList(); // Vehicles smaller than pivot
    ArrayList greater = new ArrayList(); // Vehicles greater than pivot
    Vehicle pivot = list.get(0);  // first Vehicle in list, used as pivot
    int i;
    Vehicle j;     // Variable used for Vehicles in the loop
    for (i=1;i