answersLogoWhite

0


Best Answer
  • each element in a linked list contains, in addition to data, one or more pointers to other element(s) in the list. such data structures are capable of changing size at runtime according to the needs of the program
  • an array is simply a preallocated block of data elements. once allocated at compile/link time its size can never be changed
User Avatar

Wiki User

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

Wiki User

14y ago

linked list consists of data nodes, each pointing to the next in the list. An array consists of contiguous chunks memory of predetermined size.

Linked lists are quite flexible. They can grow to any size -- up to resource limits -- and each node can be a different size. Memory allocation for a node is done as needed, usually when a new node is added.

Linked lists can be circular, or doubly-linked (pointers forward and backward), and new nodes can be inserted anywhere in the chain.

The greatest downside to linked lists is sequential access: to find any node in memory, each previous node must be examined and the pointers followed. Linked lists are also more complex to program and manage.

Arrays are fixed in size, so resources must be anticipated and consumed in advance. Each element is the same size and must contain the same data type. But access to a particular element is very fast, because its location in memory can be determined mathematically and accessed directly (offset from start of array = subscript * element size).

Note that modern languages -- especially OO languages such as C++ and Java -- blur this distinction by providing classes which offer the best of both worlds. Arrays can grow; linked list complexity is hidden from the programmer; hash tables (special arrays, really) allow for rapid indexing of arbitrary data. But under the hood, each complex data type is implemented using primitives such as arrays and linked lists.

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

Difference between arrays and linked list?

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Difference between arrays and linked list?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you find the difference between two arrays in Java?

for arrays you can list the different arrays and what attributes that you give to them.


Difference between linear linked list and circular linked list?

LINEAR STRAIGHT CIRCULAR CURVED


Can you simulate linked list using arrays?

I would say no, but it really depends on your point of view. An array and a linked list can both hold the same data; the only difference is how they do so. The definition of a linked list is a sequence of connected nodes. An array is a contiguous block of memory, so you can think of an array as a linked list in which each element is spacially connected to the next.


Can a linked list implemented using an array be accessed by giving the location?

A linked list implemented with an array defeats the purpose of using a linked list, which is to address the memory allocation problems associated with arrays.


To enter n nos without using arrays in c?

Use a linked-list.


W difference between a linear linked list and a circular linked list?

I would say that there is no such thing as a circular queue. The point of a circular data structure is to allow the end to loop around to the beginning. Since you can only remove items from the beginning of a queue or add them to the front, having these two items linked has no purpose nor benefit.


What is the difference between arrays and linked list?

An array is a list of objects.A linked list is made up of nodes each containing a value then the pointer to the next node.Linked list exampleNode 1:dog,continued in node 4Node 2:undefinedNode 3:mouse,end of listNode 4:cat,continued in node 3Array example:dog,cat,mouse,pony,horse


What is the difference between linked list and Ordinary list?

A list is an abstract data structure, usually defined as an ordered collection of data. A linked list refers to a specific implementation of a list in which each element in the list is connected (linked) to the next element.


Comparison between linked and array lists?

The difference between linked and array lists is in how they are stored. Arrays are a predefined block of memory into which information is stored or recalled. Any data element from an array can be retrieved in O(1) time. But if you need to increase the size of the array, you would need to create a new one and copy the contents of the old one into it. Linked lists are usually dynamically allocated during run time, and the only way to get to a node (a data element) is to traverse the list until you find it which makes the retrieval time slower O(n) . The benefit of a linked list is that you can insert new data elements without having to copy or move all the elements in the list as you would in an array. The linked list is better for large databases that need to add and remove items often, whereas arrays are better for list sizes that generally don't change.


How do you represented linked list in memory?

Memory Representation of Linear Linked List:Let LIST is linear linked list. It needs two linear arrays for memory representation. Let these linear arrays are INFO and LINK. INFO[K] contains the information part and LINK[K] contains the next pointer field of node K. A variable START is used to store the location of the beginning of the LIST and NULL is used as next pointer sentinel which indicates the end of LIST. It is shown below:


What is the differnce between linked list and arrays?

A linked list is a series of elements, each containing a pointer or index to the next element in the list. You can dynamically add and delete elements in the list. An array is a contiguous block of repeated elements. Since each element is address-wise adjacent to the next element, there is no need for pointers or indexes to the "next" element. You can not dynamically add and delete elements in an array, although you can create "dynamic arrays" with (templates and) classes that auto-resize themselves. The STL does this for you, but it is a good exercise to implement it yourself.


What is the difference between doubly linked list and circular linked list?

A doubly linked list is a linked list in which each node knows where both of its neighbors are.A circular linked list is a linked list in which the "tail" of the list is linked to the "root". (Note that both the tail and root of the list are undefined/arbitrary in a circular linked list)Doubly linked lists are actually not necessarily related to circular linked list (aside from both being based on a linked list structure). In fact, you can have a circular doubly linked list, where each node knows where both of its neighbors are andwhere the list wraps around to connect to itself.