answersLogoWhite

0

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

User Avatar

Wiki User

17y ago

Still curious? Ask our experts.

Chat with our AI personalities

ProfessorProfessor
I will give you the most educated answer.
Chat with Professor
CoachCoach
Success isn't just about winning—it's about vision, patience, and playing the long game.
Chat with Coach
MaxineMaxine
I respect you enough to keep it real.
Chat with Maxine

Add your answer:

Earn +20 pts
Q: How linked lsts can be usd to represent long integers?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering