in reply to Re^2: Array VS Linked List
in thread Array VS Linked List

The point was that, from within Perl itself (and not dipping into XS), the array is the best data structure for handling the needs of a linked list. Yeah, you could create a hashref for each node and put in references to the next element. But, I would be shocked and appalled if doing that was faster than the corresponding array implementation.

The only benefit I can see is if you are translating algorithms directly from C (or a similar language) and want to have functions that you can pass nodes and it can call $node->next or $node->prev. But, translating functions to take $arr and $idx instead and $node->next translates to $arr->[$idx+1] is probably saner.


My criteria for good software:
  1. Does it work?
  2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?