answersLogoWhite

0


Best Answer

You would use linked lists instead of arrays in two instances:

1) You don't know how long your list will be and it is apt to dramatically change length.

2) You will make lots of additions and removals in the middle of your list.

User Avatar

Wiki User

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

Wiki User

11y ago

A "linked list" uses pointers to refer to the next and/or previous members in a list. A single-linked list uses only one pointer to refer, typically, to the next member, whereas a doubly-linked list uses two pointers to refer to the next and previous members.

Linked lists are useful if you intend to remove or add items from anywhere in the list: beginning, middle or end. In an array, you'd have to shift entire sections of memory around if you wanted to add or remove items. In a linked list, however, you merely change a couple of pointers and allocate or free memory for an item.

By its very nature, a stack is a LIFO (Last In First Out) structure. A computer processor uses stacks, for instance, to push items onto and pop items off of the end of a list. The term "stack" means that items other than that on the end of the list is not available for use under any circumstances. You can only push an item onto the end of a stack, and pop an item off from the end of the stack.

Linked lists are considered an inappropriate methodology for implementing stacks primarily because you end up using more computer memory for storing a linked list than you would an array. It's recommended you stick to arrays using the realloc() style of functions, since the processor and memory usage are, in comparison to the respective usages of linked lists, minimal.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Why you use linked list instead of arrays?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

To enter n nos without using arrays in c?

Use a linked-list.


What are the disadvantages of a linked list?

Linked lists use more memory than arrays, and finding an element in the list requires scanning the entire list instead of simply using a base pointer and index. As a result, linked lists are not well suited for data with a large number of elements. They are best used for a small number of elements that use a lot of space (relatively speaking).


Where linked list using?

linked list are used for creation of stack,queues to use memory in optimum manner linked list are used as they are dynamic in nature


Can you use binary search on linked list elements?

No.


What is difference between linked list and singly linked list?

Answersingly linked list has the node inserted only at one end. and the pointer corresponds to the next pointer.but in a doubly linked list, the node pointer points to the both previous and the next node.singly linked list has two nodesdoubly linked list has three nodesA doubly linked list makes sense when you need to traverse the list in both directions. You aren't able to do that with a singly linked list.


What Linked list uses.type of memory allocation?

Linked lists use dynamic memory allocation (also called "heap memory allocation", as the linked list is stored in heap memory).


What is the purpose of avail list in linked list?

the purpose of avail list in link list is to use deleted nodes again


What is the PHP foreach construct used for?

The PHP foreach construct is used to iterate over arrays. This is done in the field of mathematics. It will issue errors when one tries to use it as a variable instead of arrays and objects.


Array in c plus plus must be defined at compil time?

No. Arrays can be defined at runtime, just as they can in C. It's just that it's generally more convenient to use vectors instead of dynamic arrays at runtime, thus arrays are generally used statically, at compile time.


How would you sort a linked list?

Use merge sortUse tree sort


Can we use doubly linked list as a circular linked list?

Yes. The tail node's next node is the head node, while the head node's previous node is the tail node.


Why linked list reprsentation is preferred?

In memory it is always required to use memory space properly.In linked list representation it is easier & searching for data is also quicker than linear array.