1.

Why Is It Difficult To Store Linked List In An Array?

Answer»

Both Arrays and LINKED List can be used to store linear data of similar types.

Linked list provide DYNAMIC size while the size of ARRAY is fixed, So we must know the upper limit on the number of elements in advance.

Linked lists have following drawbacks:

  1. Random ACCESS is not allowed. We have to access elements sequentially starting from the first node. So we cannot do binary search with linked lists.
  2. Extra memory space for a pointer is required with each element of the list.
  3. Arrays have BETTER cache locality that can make a pretty big difference in performance.

Both Arrays and Linked List can be used to store linear data of similar types.

Linked list provide dynamic size while the size of array is fixed, So we must know the upper limit on the number of elements in advance.

Linked lists have following drawbacks:



Discussion

No Comment Found