What is linked list?
- Linked list is callection of nodes.
- Not contiguous in nature
- can store any data type
- size can be increased or descreased
Issue with array
- Array is stored in contiguous memory location
- size cannot be increased or descreased
- can only store homogeneous data
Defining Node
What we did here
- Defined the structure of our node
- If node is created, data and pointer is given then it initialize it.
- If only data is given in initilise that one also
But it has been implemented using struct, which doesnot support OOP, we can implement same with class, nothing to do much just replace struct with class