Differences between Arrays and Linked lists

What are the differences between Arrays and Linked lists and why we go for linked lists if we have pointers to arrays?

Showing Answers 1 - 34 of 34 Answers

mahesh

  • Nov 6th, 2006
 

arrays cannot be expanded or increased so we use linked list for dynamic data storage

  Was this answer useful?  Yes

shekhar

  • Nov 7th, 2006
 

For example::

We want to delete some elements from array then either we have to place zero or we need to rearrange it.

For dynamic deletion and insertion linked list is used instead arrays.

But if we do not need these operations then using arrays is sufficient and easier too.

  Was this answer useful?  Yes

rathnam

  • Nov 14th, 2006
 

space/time trade-off are the parameters to differentiate between them.

Space:

=====

 In the case of Arrays: for storing 10 elements, we need only 10* sizeof(element) bytes.

In the case of Lists: for storing 10 elements, we need at least 10*(sizeof(element)+sizeof(int*));

so, we need more space in the case of linked lists to store the same data when compared to lists.

=> Arrays are better;

Time:

====

In the case of Array indexing is possible, so it takes constant time to access a particular data item. But where as in the case of lists, random access is not possible, it takes variable amount of time to access a particular data item.

=> Arrays are better.

Misselleneous:

===========

1) Some data structures can be represented easily with linked lists when compared to arrays.

2) Addition and Deletion is easier in the case of lists.

3) making a copy is easier in the case of Arrays because the memory is contigeous.

  Was this answer useful?  Yes

Manoj

  • Dec 27th, 2006
 

Arrays and Linked list both are list data structures used for maintaining a list of values. Arrays use sequential allocation while Linked list uses linked allocation. > Linked list uses some extra memory i.e. link pointer. > Indexing an element, e.g. accessing kth element is cheaper in arrays and costly in Linked list.> Insertion and Deletion of elements is a cheaper operation in Linked lists.> Since nodes in Linked list are dynamically allocated, it has no limitations on growth (apart from memory constraints). > Merging Lists is easier in case of Linked lists. > Breaking a List into two or more lists is easier in case of Linked lists.so Linked list is a better data structure in most cases. Arrays are goos mostly for static data structures.

Arup Ratan Banerjee

  • Jan 29th, 2007
 

All the above statements reveal that link list is of better data structure than that of Array.But if we want to perform Sorting ( Ex: Bubble Sort, Insertion Sort, Quick Sort) by means of Link List then the time complexity will be much more than that of implementing the same with an Array

  Was this answer useful?  Yes

sumit.manchanda

  • Mar 2nd, 2007
 

Arrays are stored in contigious memory ie (if suppose arr[12] is an integer array containing 12 elemnts, if memory address of ist elemnt is say 1088 then memoy address of next element in array would be 1090 & the next memory address would be 1092 as size of an integer value is 2 bytes) where as in linked lists it is not the case. In linked lists elements are not stored in contigious memory allocations, in linklists  every node contins a pointer which contains the address of next node in linked list.

  Was this answer useful?  Yes

sumit.manchanda

  • Mar 2nd, 2007
 

Arrays are stored in contigious memory ie (if suppose arr[12] is an integer array containing 12 elemnts, if memory address of ist elemnt is say 1088 then memory address of next element in array would be 1090 & the next memory address would be 1092  as size of an integer value is 2 bytes) whereas in linked lists it is not the case. In linked lists elements are not stored in contigious memory allocations, in linklists  every node contins a pointer which contains the address of next node in linked list.

  Was this answer useful?  Yes

According to me Arrays can't declared dynamically.i.e they can't allocate memory dynamically. when ever we want to add more eliments than the size of Array it is not possible.

In the case of Linked lists we can dynamically create any no of nodes and insert them at any point.And deletion of eliments,insert eliment in the middle is also more easy here.

Not only that If we want to store 10 eliments,inarrays we need 10*(Size of datatype) bytes contiguous memory locations. But in Linked lists there is no need of contiguous memory locations.

But both have their own features,and disadvantages, at that time situation we should have deside which one fullfit for our applications.

ThankU
Ashok

  Was this answer useful?  Yes

kpmsiva

  • May 24th, 2008
 

Arrays are collections of repeated data items. Structures are complex data items made up of other data items, including, potentially, other structures and arrays. You can, of course, also have arrays of structures. Array can be useful when static type and for dynamic structure type.

  Was this answer useful?  Yes

Renuka Negi

  • Sep 19th, 2011
 

1. Array is a linear data structure but linked list is linear and non-linear data structure.
2. Array is expensive than linked list.

  Was this answer useful?  Yes

Parshotam

  • Sep 20th, 2011
 

array is a group of similar data items which sharing a common name we can defined it by the first data type, name of array and then the size as follows:

int array[10];

the data type can be from others also.

And link list on the other hand is different from the array link list contains the value and the address of the next connected node.

We use the link list because it is easy to understand.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions