Jun 122012

What is the difference between Linked List and Arrays?


Before talking about the differences, lets see the similarities:

How arrays are similar to linked Lists

1. Both are collection of elements.

2. Both Linked List and Arrays are homogenous collection of elements. i.e all the elements in a linked list (or an Array) has to be of the same type. All Nodes in linked list have same data type. (You may argue, that we can have an array of void pointers each of which can point to element of different data type, like below:

    char ch;
    int ivar;
    void * arr[2] = {&ch, &ivar};

but in the above case also the data type of both the elements in array is same (void *).

Next: Differences …

  One Response to “Difference between linked list and Arrays”

Comments (1)
  1. why we can not use binary search in linked list even it is sorted,what is main reason behind this fact?

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>