kennyledet / Algorithm-Implementations

Share, discuss and learn about algorithm implementations!
http://algorithm.zone
MIT License
2.2k stars 532 forks source link

Inneficient lifo stack in Lua #536

Open xopxe opened 5 years ago

xopxe commented 5 years ago

The lifo stack at: https://github.com/kennyledet/Algorithm-Implementations/blob/master/Depth_First_Search/Lua/Yonaba/utils/lifo.lua Inserts aand removes from the begining of the array. this causes a renumbering of the array after each push or pop. It is better to store the stack reversed, with the last element at the last position.

kennyledet commented 5 years ago

How's it going keshav,

This was implemented by one of our top contributors @Yonaba , but way back in 2014. You're more than welcome to update on top of this and contribute an optimized implementation!

Best, Kendrick