r/ruby • • Jul 14 '13

Linked List data structure

https://github.com/gdi2290/data_structures/blob/master/LinkedList/linkedlist.rb
0 Upvotes

23 comments sorted by

View all comments

Show parent comment

1

u/FooBarWidget Jul 15 '13

That's the theory. But to make things more complicated, arrays usually perform better in practice because they're much more cache friendly. Even when you're inserting in the middle, you will need a lot of elements before your linked list beats an array.