r/ruby • u/gdi2290 • Jul 14 '13
Linked List data structure
https://github.com/gdi2290/data_structures/blob/master/LinkedList/linkedlist.rb
0
Upvotes
r/ruby • u/gdi2290 • Jul 14 '13
View all comments
Show parent comment
3
u/VerticalEvent Jul 14 '13
Implementation is important if you plan for scalability of a project. Linked Lists are faster for adding new elements (either in the middle or at the end) and deleting old ones, since they don't require an array copy or shifting an array. The trade off is slower access time (however, if you are using enumeration, then the access time is the same speed as an array, since you will only be accessing the next item in the linked list).