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.


16.4k views

Related Posts

@Ankita Katdare · Aug 23, 2012

Renewable is not only the need of the hour, but also the talk of the town. And Engineering students are opting for the green when it comes to their B.E./B.Tech...
109k views

@Pragathi_ · Jun 20, 2011

I am doing my final year b.tech c.s.e. . i have done my ccna course. i want to do a final year project based on ccna course. Can u guide...
3.6k views

@Kaustubh Katdare · Jan 12, 2015

CrazyEngineers Presents Hunt For India’s Best Academic Project ​About The Contest CrazyEngineers is on a mission to hunt for the best academic project being worked on by engineering students all...
6.4k views

@Sahithi Pallavi · Aug 1, 2011

What is the placement procedure for Cisco? Could someone share the details of it? I have heard the Eligibility is - 1. 70% aggregate marks or (equivalent scores) throughout in...
5.8k views

@Ankita Katdare · Aug 31, 2011

What kind of innovative events can be conducted for civil engineering students in their tech-fest?Suggest ideas and names for the same.
19.1k views