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

Inserting an element in a Linked List is easy, but in an array it may be time consuming. For example: if we have a sorted array (of size 10) like below (last 4 positions are empty which are represented by _):

2 4 6 8 10 15 _ _ _ _

and we want to insert 7 in this sorted array, then we have to shift 3 elements by one position.

2 4 6 7 8 10 15 _ _ _

In case of linked list pointers could have been manipulated and no shifting would have been required.

Next: Deleting element …

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

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