local function quick_sort(tbl,low,high)
if low >= high then
return;
end
local first = low;
local last = high;
local key = tbl[first];
while first < last do
while first < last and tbl[last] >= key do
last = last - 1;
end
tbl[first] = tbl[last];
print_tbl(tbl)
while first < last and tbl[first] <= key do
first = first + 1;
end
tbl[last] = tbl[first];
end
tbl[first] = key;
quick_sort(tbl,low,first - 1)
quick_sort(tbl,first + 1,high)
end
local tbl = {6,2,7,6,3,8,9}
tbl = {2,3,6,6,7,8,9}
quick_sort(tbl,1,6)
end