Compute polynomial, Cn.x^n + Cn-1.x^(n-1) + … … + C2.x^2 + C1.x + C0
June 12, 2012
Non-leaf nodes of a binary tree
June 12, 2012

Difference between linked list and Arrays

What is the difference between Linked List and Arrays?

Answer:

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 …

1 Comment

  1. anuj says:

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

Leave a Reply to Anonymous Cancel reply

Your email address will not be published. Required fields are marked *