📜  数组列表的快速排序 - Java 代码示例

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

代码示例1
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