- 打卡等级:热心大叔
- 打卡总天数:94
- 打卡月天数:17
- 打卡总奖励:94
- 最近打卡:2025-01-18 01:28:20
|
- local list = { 3,1,5,18,34,32,0, }
-
- function printList()
- local str = ""
- for i = 1,#list do
- str = str .. list[i] .. " "
- end
- print(str)
- end
-
- function qsort(low,high)
- if low >= high then return end
- local first = low
- local last = high
- local key = list[first]
- while first < last do
- while first < last and list[last] >= key do last = last - 1 end
- list[first] = list[last]
- while first < last and list[first] <= key do first = first + 1 end
- list[last] = list[first]
- end
- list[first] = key
- qsort(low,first - 1)
- qsort(first + 1,high)
- end
-
- printList()
- qsort(1,#list)
- printList()
复制代码
|
|