Data Structure: What is linked list?
Following points illustrates about what is linked list.
- It is a special list of some data elements linked to one another.
- Logical ordering is represented by having each elements pointing to next element.
- each element is called node, which has two parts, (a) Info – stores the information (or data) (b) next – points to next element (i.e. address of next node)
- Grow or shrink depending upon operation mode.
- Entire linked list is accessed from an external pointer that contains the address of first node, but this is not included in the linked list.
- The next address of last node contains special value called NULL, represented by electrical ground symbol.
Advantage of Linked list over array
- Dynamic nature i.e. grow or shrink according to operation performed.
- Insertion deletion are efficient and easier.
- Necessary memory utilization.
Disadvantage of Linked list
- Arbitrary access is difficult and time consuming.
- Extra memory is required for storing address of the next node.
The implementation of C++ in linked list will be discussed in next post.