Question

What is the difference between an array list of linked list and a two dimensional linked...

What is the difference between an array list of linked list and a two dimensional linked list

What is the benefits of these structures and some of the disadvantages them?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

A List is a set of data arranged in some sort of order. In many cases (especially in OOP) the details of how the data is set up is unimportant. What matters is that you can access a particular element (ie in a particular position), insert or delete an element from a position or before or after a particular element. The ability to sort or shuffle a list is also useful. The main methods of implementing lists is either arrays or linked lists.

An Array is a list of data stored in contiguous (usually) blocks of memory. The advantage of using an array is that elements can be accessed in constant time and arrays are ideal for use with loop counters. An element in array A can be accessed by writing A[i]. Arrays may also be entirely within a memory cache which makes accessing an element very fast.

The disadvantages of an Array are that insertions or deletions usually mean moving all of the elements in the array along to make space for the new element or fill in a gap. Arrays are usually of a fixed size. If a larger array is needed then this usually means creating a new one and copying the elements over.

A Linked List is a list of data implemented with “nodes” where each node consists of an element of data and one or more pointers to other nodes. The main advantages of linked lists are that insertions or deletions don’t require moving the other nodes around in memory. All that is required is to change the link pointers. Linked lists don’t have a fixed length. The only limitation to the number of nodes in a linked list is the amount of memory you have.

The disadvantage of a linked list is that there is no instant access to a particular element or node (except the first one). You need to search through the list - following the links - to find a particular element. (Various search trees exist to try and minimize the search time). Nodes are not necessarily in contiguous blocks of memory and many nodes may not be in the memory cache at any one time. This increases the time taken to search for a node.

Add a comment
Know the answer?
Add Answer to:
What is the difference between an array list of linked list and a two dimensional linked...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT