CrazyEngineers Archive
Old, but evergreen and popular discussions on CrazyEngineers, presented to you in read-only mode.
@Dixsita • 15 Sep, 2009
I wish to discuss the advantages of link-list over array? I've been referring to the basic C-programming books, but haven't been able to make anything out of it.
@dipen30 • 15 Sep, 2009 • 1 like Re: Dfs

1. Array size is fix and cannot change at run time,But in
link list we can create memory accoring to requirement.

2. In array we define but at the run time it is not used so
in that case memory is waste.
@faizaan • 15 Sep, 2009 Re: Dfs

hi,
when we declare an array than the contiguous memory is allocated for that by compiler
so to declare a array of given size we require contiguous free space .But in case of linklist
we do not require contiguous free space each element will contain pointer that will give address of next free location.so linklist uses memory more wisely .
@Kaustubh Katdare • 15 Sep, 2009
Dixsita
Advantages of linklist over array??😕
Always provide a better title to your discussion threads.

*title edited*
@Saandeep Sreerambatla • 15 Sep, 2009 Faizaan is exactly correct.

Moreover, just try to write a program which sorts 5 elements of array using some method of sorting , like selection, merge, quick etc.

Then consider these 5 elements as linked lists and try sorting it , then you will get fewer combinations.

So effeciency is increased using Linked lists.
@yash.kumar • 16 Sep, 2009 1. the memory distribution in linked lists is not contiguous unlike arrays, i.e., the memory is taken from the space available anywhere, and then a link is set with the previous node. However, arrays don not have this feature, and the memory distribution should be contiguous.

2. insertion and deletion in linked lists are easier than in arryas.
for e.g.- consider the list-
A--B--C--D--E----- so on
now, to remove any element, we can delete it, and link the elements linked to it together:
A--C--D--E--, B removed.
Here , we do not change the index or the position of the elements, but we just change the links. Similar is the case with additon.
However, in arrays, we have to change the index or the location each time we insert or delete any element.
@Sahithi Pallavi • 16 Sep, 2009
yash.kumar
1. the memory distribution in linked lists is not contiguous unlike arrays, i.e., the memory is taken from the space available anywhere, and then a link is set with the previous node. However, arrays don not have this feature, and the memory distribution should be contiguous.

2. insertion and deletion in linked lists are easier than in arryas.
for e.g.- consider the list-
A--B--C--D--E----- so on
now, to remove any element, we can delete it, and link the elements linked to it together:
A--C--D--E--, B removed.
Here , we do not change the index or the position of the elements, but we just change the links. Similar is the case with additon.
However, in arrays, we have to change the index or the location each time we insert or delete any element.

Good answer. these are the two main differences.





WINNERS DONT DO DIFFERENT THINGS....THEY DO THINGS DIFFERENTLY........
@pushpen mahawar • 18 Sep, 2009 Resizing or compressing an Array (removing ) takes linear time, Link lists are compressed and resized automatically, in constant time. Deleting would be the same speed, if you can live with "Null" elements in your array. If you have to compress the array afterwards, a list is your best bet.

Arrays are good for random access and good for sequential access (both are in constant time). Linked lists on the other hand are constant for sequential, but linear for random access.

The choice of which datastructure to use, depends entirely on the problem you're trying to solve.
@rajayya • 23 Sep, 2009
Dixsita
Advantages of linklist over array??😕
In the linked lists data be connected int the form of chain.that means the head of the one node shud be connected the tail of the another node.The data can be accessed from any where in the list.
In arrays data having the index and surely data can be accessed from 1st onwrds.
@rajayya • 24 Sep, 2009 Re: Dfs

Excuse me y don't u expand it.
@Mohana Chandra • 23 Jan, 2020 • 1 like
  • Memory allocated for Linked list can expand or shrink by allocating or deallocatiing the memory during run time,which is termed as dynamic memory allocation. Due to this feature Linked Lists provides Less Memory Wastage.
  • Linked lists provides ease for Insertion /Deletion by using its pointers, where as in arrays we have to sort elements and only then we will able to easily insert or delete its elements.
  • Stacks and queues are implemented by using Linked lists.This is also an advantage,as stacks and queues are being the major concepts with many applications.
@Durgesh Srivastava • 29 Jan, 2020

Arrays and Linked Lists both are linear data structures, but they both have some advantages and disadvantages over each other.

One advantage of the linked list is that elements can be added to it indefinitely, while an array will eventually get filled or have to be resized (a costly operation that isn't always possible). 

Elements are also easily removed from a linked list whereas removing elements from an array leaves empty spaces that are a waste of computer memory.

@Karshil Sheth • 14 Feb, 2020

Array

  1. Collection of same data type elements.
  2. In Array we can just put the index number in square brackets.
  3. Fast retrieval of number here.
  4. Less memory as size is already defined.


Linked List

  1. It contains nodes which are unordered.
  2. In LL we have to traverse via head node.
  3. slow compared to array.
  4. More Memory utilization.


13.6k views

Related Posts

@Ankita Katdare · Jul 29, 2015

My uncle who is a successful civil engineer came to me with that day's newspaper. He wanted to show me an advertisement for the local college. The college's ad had...
11.9k views

@Kaustubh Katdare · Nov 5, 2015

ISRO has released a free eBook about India's Space Journey, titled 'From Fishing Hamlet To Red Planet', edited by P.V. Manoranjan Rao along with associate editors B.N. Suresh and V.P....
2k views

@mmm111 · Aug 18, 2013

Am into my 1st year b.tech.. i want to appear and get good rank in gate 2017..suggest me ebooks and links of study materials related to it..where to start for...
20.5k views

@micromahesh · Feb 17, 2009

Hi! i want to convert bluetooth signal to WiFi signal or some other technology. Is it possible ? 😔 If it is possible means how can i done this ?...
3k views

@Ankita Katdare · May 8, 2012

Some of the best books under the title of Mobile Computing are as follows: Mobile Communication 2nd edition by Jochen Schiller, Pearson education Mobile Computing by Asoke Talukder, Roopa Yavagal...
2.3k views