18
Does anyone know how efficient shift and unshift are in a ruby array?
Deleting from the beginning of an array and having to move every element in memory can become very inefficient. I assume ruby does this some other way.
Any info on the following would be helpful:
- Algorithmic runtime
- Implementation
- General efficiency
- Would shift/unshift be acceptable to use for a queue (in something like C++ this would not)
Thank you!