answersLogoWhite

0


Best Answer

# Linked lists do not need contiguous blocks of memory; extremely large data sets stored in an array might not be able to fit in memory. # Linked list storage does not need to be preallocated (again, due to arrays needing contiguous memory blocks). # Inserting or removing an element into a linked list requires one data update, inserting or removing an element into an array requires n (all elements after the modified index need to be shifted).

User Avatar

Wiki User

15y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

Both arrays and linked lists have their advantages in different situations. These advantages can vary by language. For example, Java & C# technically don't have pointers, but references to objects.

Array advantages (over linked lists):

* Can be allocated in a single block. * Uses less memory (linked lists need one or two extra pointers per element). * Allows for fast random access (e.g., computed access, X[5]) Array Disadvantages (over linked lists):

* Harder to dynamically grow/shrink (usually allocated larger/smaller array and copy current contents into it). * Harder to insert/delete/move chunks of data around (involves block copy statements to slide the rest of the array left or right) In general:

* An array is more appropriate for collections of a known size, needing fast/random access. * Linked lists are more flexible (faster growth/shrink, insert/delete/move), but have slower access time and use more memory for storage.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What are the advantages of linked list over arrays?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Explain any two advantages using Single linked list over Doubly linked list and vice-versa?

Advantages of single linked list: # Decrease in storage space per linked list node # Simpler implementation Advantages of double linked list # Decrease in work when accessing a random node # Decrease in work when inserting or deleting a node


What advantages of a sorted list over a linked list?

All lists are linked lists; there is no such thing as a separate "sorted list". There are algorithms that can sort a list, of course, but they all work on linked lists.


Convert single linked list to double linked list?

You copy a singly linked list into a doubly linked list by iterating over the singly linked list and, for each element, calling the doubly linked list insert function.


How do you solve josephus problem using circular linked list?

The Josephus problem is a problem to locate the place for the last survivour. It shows the power of the circular linked list over the singly linked lists.


What are disadvantages of a linked list over an array?

A linked list is better bcoz: 1. A linked list can be grown to any size whereas a statically allocated array is of a fixed size and hence can cause problems if you try to insert beyond that. 2. Deletion of elements is a problem in arrays. You either have to move all the elements following the deleted element forward which is a waste of time or you have to place a sentinel indicating that the element in that position is deleted which causes a waste of space. On the flip side, arrays are easier to handle because their memory allocation is done once and for all(atleast till you need more space and have to reallocate) and because there is no hassle with pointers.

Related questions

Explain any two advantages using Single linked list over Doubly linked list and vice-versa?

Advantages of single linked list: # Decrease in storage space per linked list node # Simpler implementation Advantages of double linked list # Decrease in work when accessing a random node # Decrease in work when inserting or deleting a node


What advantages of a sorted list over a linked list?

All lists are linked lists; there is no such thing as a separate "sorted list". There are algorithms that can sort a list, of course, but they all work on linked lists.


Disadvantages of linked lists in c?

Because the C programming language leaves the responsibility for memory allocation and pointers entirely with the programmer, the disadvantage of linked lists over some other linear data structures (such as arrays) is that the bear a risk or memory leaks and invalid pointers. The fact that the size of a linked list is generally not deterministic is also commonly viewed a disadvantage over statically linked linear containers (e.g. arrays) in some systems, primarily in embedded systems. Compared to containers of higher order (such as trees or hash tables), search operations in a linked list are generally slower. Compared to a double linked list, removal and insertion of items (except head and tail) is generally more expensive.


Convert single linked list to double linked list?

You copy a singly linked list into a doubly linked list by iterating over the singly linked list and, for each element, calling the doubly linked list insert function.


What advantages do corporations have over small businesses?

List two advantages that corporation have over a small business


How do you solve josephus problem using circular linked list?

The Josephus problem is a problem to locate the place for the last survivour. It shows the power of the circular linked list over the singly linked lists.


What are disadvantages of a linked list over an array?

A linked list is better bcoz: 1. A linked list can be grown to any size whereas a statically allocated array is of a fixed size and hence can cause problems if you try to insert beyond that. 2. Deletion of elements is a problem in arrays. You either have to move all the elements following the deleted element forward which is a waste of time or you have to place a sentinel indicating that the element in that position is deleted which causes a waste of space. On the flip side, arrays are easier to handle because their memory allocation is done once and for all(atleast till you need more space and have to reallocate) and because there is no hassle with pointers.


What are the advantages and disadvantages of DLL over single linked list?

The main advantage of a doubly-linked list is that you can traverse and search the list both forwards and backwards. Although you can also add to the beginning and end of the list, and retrieve the same, in constant time O(1), this is also possible with a slightly modified singly-linked list simply by maintaining a pointer to the last node as well as the first. Thus the only real difference is whether you need to traverse bi-directionally or not. If not, a modified singly-linked list would be more efficient. And if you only require fast access to the first node, a standard singly-linked list would be slightly more efficient.


What are the Advantages of linked list over stack and queue?

A linked list is a data structure in which each node has a pointer to the next node, and thus the whole list is linked. Some advantages are: * Easy traversal of the whole list (simply follow the pointers) * Easy insertion and deletion of nodes (don't need to move all the other nodes around)


What men advantages?

If you mean what advantages do men have over women I would say that not getting your period is up on the top of the list. However women have many advantages over men.


What is the advantage of doubly linked list over Doubly linked list?

A doubly linked list can be traversed in both directions (forward and backward). A singly linked list can only be traversed in one direction. A node on a doubly linked list may be deleted with little trouble, since we have pointers to the previous and next nodes. A node on a singly linked list cannot be removed unless we have the pointer to its predecessor. On the flip side however, a doubly linked list needs more operations while inserting or deleting and it needs more space (to store the extra pointer).


Disadvantages of circular link list as compared to singly link list?

As compared with doubly-linked lists, one disadvantage is that singly-linked lists can only be efficiently traversed in one direction. Finding the (n - 1)th element, given only a pointer to the nth, requires scanning the list from the first element up to the (n - 1)th. Thus (if memory is too limited to permit tricks such as creating a reversed list) to iterate over the entire list in reverse order would require n + (n - 1) + ... + 1 = n(n + 1)/2 link traversals, which grows quadratically with n. Obviously for a doubly-linked list the time merely grows linearly with n.A down-side of all linked lists versus arrays is that random access can be inefficient; the time taken to find an element with a randomly chosen index grows in direct proportion to the list's length (since we must scan from one of the ends). In contrast, an array allows us to index directly to the elements with simple pointer arithmetic, in a time independent of the array's size - at least in an idealised environment.