Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Linked lists are overused even in C, where they have a natural expression.

The reason to use a list instead of an array is that it's cheap to insert/delete anywhere into a list, but expensive to do so in the middle of an array.

There's probably no expression of a list in Ruby where insertion is cheaper than inserting into an array. Perhaps if your "list" is a secondary Fixnum index on a larger pool of objects? At any rate, that's no longer a "linked list".

I think it's a silly question. I hope the expected answer is, "why would I ever do that?"



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: