What is linked list? How is it different from array?

Answers

This answer is not selected as best answer. This answer may not be sufficient for exam.

Your limit has been exceed. We have implemented this system because, We got difficulty on managing our servers. Please donate some amount to remove this limit.

Quota: 0 / 30

Donate

A linked list is a linear data structure, in which the elements are not stored at contiguous memory locations. The elements in a linked list are linked using pointers as shown in the below image:

User Loaded Image | CSIT Guide

In simple words, a linked list consists of nodes where each node contains a data field and a reference(link) to the next node in the list.

The difference between linked list and array are

BASIS FOR COMPARISON ARRAY LINKED LIST
Basic It is a consistent set of a fixed number of data items. It is an ordered set comprising a variable number of data items.
Size Specified during declaration. No need to specify; grow and shrink during execution.
Storage Allocation Element location is allocated during compile time. Element position is assigned during run time.
Order of the elements Stored consecutively Stored randomly
Accessing the element Direct or randomly accessed, i.e., Specify the array index or subscript. Sequentially accessed, i.e., Traverse starting from the first node in the list by the pointer.
Insertion and deletion of element Slow relatively as shifting is required. Easier, fast and efficient.
Searching Binary search and linear search linear search
Memory required less More
Memory Utilization Ineffective Efficient
If you found any type of error on the answer then please mention on the comment or submit your new answer.
Leave your Answer:

Click here to submit your answer.

Discussion
0 Comments
  Loading . . .