Tuesday 6 September 2011

array vs list

Diff between array and list
1) Array is collection of homogeneous elements.
List is collection of heterogeneous elements.
2) For Array memory allocated is static and continuous.
For List memory allocated is dynamic and Random.
3) Array: User need not have to keep in track of next memory allocation.
List: User has to keep in Track of next location where memory is allocated.
4) Array size should be specified but the list size can be determined at run time also.
NOTE : Accessing an element in Array is faster, the reason it is continuous.

No comments:

Post a Comment