aboutsummaryrefslogtreecommitdiff
path: root/t.lua
diff options
context:
space:
mode:
authorame <[email protected]>2023-10-18 16:30:38 -0500
committerame <[email protected]>2023-10-18 16:30:38 -0500
commit4c00c7fb9a648e336973de6d4d40f535dab1410c (patch)
tree6a551b9b4633f2570159eeb83a8f8ac9e1019100 /t.lua
parentfeb025300ce464322f5e5400fb9b2b8a4e8a2a8a (diff)
md5 and sorting improvments
Diffstat (limited to 't.lua')
-rw-r--r--t.lua39
1 files changed, 19 insertions, 20 deletions
diff --git a/t.lua b/t.lua
index aef5ad1..32269c8 100644
--- a/t.lua
+++ b/t.lua
@@ -4,30 +4,29 @@ local a = llib.array
local tab = {}
math.randomseed(os.time())
for i=1,19 do
- table.insert(tab,math.random(1,99999));-- + math.random(1,999));
+ table.insert(tab,math.random(1,999));-- + math.random(1,999));
end
-
-print("length of 99999 :\n")
-time = os.clock()
-local l1 = a.quicksort(tab)
-print("quick sort took "..os.clock()-time.."s")
-time = os.clock()
-local l2 = a.mergesort(tab)
-print("merge sort took "..os.clock()-time.."s")
-time = os.clock()
-local l3 = a.shellsort(tab)
-print("shell sort took "..os.clock()-time.."s")
+--print("length of 99999 :\n")
+--time = os.clock()
+--local l1 = a.quicksort(tab)
+--print("quick sort took "..os.clock()-time.."s")
+--time = os.clock()
+--local l2 = a.mergesort(tab)
+--print("merge sort took "..os.clock()-time.."s")
+--time = os.clock()
+--local l3 = a.shellsort(tab)
+--print("shell sort took "..os.clock()-time.."s")
--time = os.clock()
--local l4 = a.bubblesort(tab)
--print("bubble sort took "..os.clock()-time.."s")
-time = os.clock()
-local l5 = a.heapsort(tab)
-print("heap sort took "..os.clock()-time.."s")
-time = os.clock()
-local l6 = a.countingsort(tab)
-print("counting sort took "..os.clock()-time.."s")
+--time = os.clock()
+--local l5 = a.heapsort(tab)
+--print("heap sort took "..os.clock()-time.."s")
+--time = os.clock()
+local l6 = a.shellsort(tab)
-for l,i in pairs(l1) do
- print(l1[l].." "..l2[l].." "..l3[l].." "..l5[l].." "..l6[l])
+for l,i in pairs(l6) do
+ print(l6[l])
end
+print(a.sum(l6))