Thursday, July 4, 2013

Differences between arrays and linked list

LINKED LIST:-
1)    Can quickly insert and delete items in linked list.
2)     You simply rerrange those pointers that are affected by the change in linked list.
3)    Linked list are very difficulty to sort.
4)    Can not immediately locate the desires element.need to traverse the whole list to reach that element.

5)    Linked list are not constrained to be stored in adjacent locations.
6)    Basically 3 types are there :- singly,doubly,and circular.
7)    Linked list is a list whose order is given by links from one item to the next.


ARRAY:-
1)       Can not do so quickly as in linked list.
2)       Inserting and deleting items in an array requires you to either make room for new item or fill the hole left by deleting an item.
3)      They are not difficulty to sort.
4)      Easy to locate the desired element.
5)      The element of an array occupy contiguous memory locations.
6)      Basically two types are there :- one dimention, two dimention.
7)      An array is a group of related data items that share a common name.




The difference between arrays and linked lists are:
     Array
1-     Arrays are linear data structures.
2-     - Array has homogenous values. And each element is independent of each other positions
3-     - Array elements can not be added, deleted once it is declared.
4-     - Array elements can be modified easily by identifying the index value.
    
       Linked lists
 1-Linked lists are linear and non-linear data structures.
 2- It is a complex process for modifying the node in a linked list.
  The nodes in the linked list can be added and deleted from the list.    
3- Linked lists are linear for accessing, and non-linear for storing in memory. Each node in the linked list is connected with its previous node which is a pointer to the node.

No comments:

Post a Comment