aboutsummaryrefslogtreecommitdiff
path: root/t.lua
diff options
context:
space:
mode:
authorame <[email protected]>2023-12-07 11:52:39 -0600
committerame <[email protected]>2023-12-07 11:52:39 -0600
commit3c06c70cccd643109d9ee8dde2767460a68dcfb0 (patch)
tree12d00056f1cde619db61584ab43315778ebdef75 /t.lua
parent843d6ce352bd0fbedb9b0945a19747ed409ebd46 (diff)
more string friendly
Diffstat (limited to 't.lua')
-rw-r--r--t.lua31
1 files changed, 5 insertions, 26 deletions
diff --git a/t.lua b/t.lua
index 32269c8..56aa0f7 100644
--- a/t.lua
+++ b/t.lua
@@ -1,32 +1,11 @@
require "llib"
local a = llib.array
-local tab = {}
-math.randomseed(os.time())
-for i=1,19 do
- 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")
---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.shellsort(tab)
+local test = {5,"meow",3,2,2,1,8}
+test = a.reverse(test)
-for l,i in pairs(l6) do
- print(l6[l])
+for i=1,#test do
+ print(test[i])
end
-print(a.sum(l6))
+print(a.index(test,"meow"))