Advantages of linked lists over arrays?

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.

Replies

  • dipen30
    dipen30
    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
    faizaan
    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
    Kaustubh Katdare
    Dixsita
    Advantages of linklist over array??😕
    Always provide a better title to your discussion threads.

    *title edited*
  • Saandeep Sreerambatla
    Saandeep Sreerambatla
    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
    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.
  • Sahithi Pallavi
    Sahithi Pallavi
    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
    pushpen mahawar
    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
    rajayya
    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
    rajayya
    Re: Dfs

    Excuse me y don't u expand it.

You are reading an archived discussion.

Related Posts

Hi Everyone I am working on a problem which requires finding k-shortest paths on a network/graph (as a sub-problem). I will appreciate if someone can point me out to Matlab...
Hi everybody, I write this small news in order to inform you an ARM network has been created around job opportunities and Vocational TRaining for student. This open group is...
hi guys i have heard that a laptop enabled with wifi can be converted as wireless router i tried this but it dint work can anyone help me out
Best Electronics and Communications Engineering student out there,,can somebody give at least 3 best related topics about ECE for my research paper.
I'm a freshmen in dlsu manila studying ECE and my prof in ENGLRES said that we need to give at least 3 topics about ECE for my research paper..thank you...