Sunday, June 19, 2011

List Vs Linked List

http://stackoverflow.com/questions/169973/when-should-i-use-a-list-vs-a-linkedlist


Linked lists provide very fast insertion or deletion of a list member. Each member in a linked list contains a pointer to the next member in the list so to insert a member at position i:
  • update the pointer in member i-1 to point to the new member
  • set the pointer in the new member to point to member i
The disadvantage to a linked list is that random access is not possible. Accessing a member requires traversing the list until the desired member is found.

No comments:

Post a Comment