views:

45

answers:

3

Give the advantages and the disadvantages of Linked List in Data Structure.

+1  A: 

You can quickly add elements (and it will expand), you can quickly remove elements. You can very easily split it in half.

Searching is linear though.

cherouvim
+2  A: 

Linked lists allow for fast insertion and deletion of elements in arbitrary locations, since two nodes are simply linked by pointers to one another, and may not necessarily reside close to one another in memory. Thus, inserting or deleting an element is just a matter of changing pointers. It is also possible to reduce memory usage with a linked list, since it is not necessary to specify a size beforehand; however, each node also takes up more memory since it stores pointers to other nodes, so the opposite may also be true. Another interesting note is that using arrays will result if fewer cache-misses when fetching data, since the elements reside close to one another in memory. Scanning elements in an array is also faster than doing so in a linked list, since getting from one node to another in a linked list requires a dereferencing operation.

+1  A: 

http://en.wikipedia.org/wiki/Linked_list

fastcodejava