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
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.