Linked List
In the simplest terms, Linked List is a non contiguous allocation of nodes in memory where each node remembers address of atleast one of its neighbours if there is any.
In the simplest terms, Linked List is a non contiguous allocation of nodes in memory where each node remembers address of atleast one of its neighbours if there is any.
We generally use a class or structure to represent the node in a linked list
In either of the scenario, our node is self-referential, that is it contains a reference ( address ) of a node of same kind
When each node contiains address of next neighbour until the we terminate with a NULL pointer that is the end of the linked list, we call such a linked list as a singly linked list
A linked list can be traversed easily using an iterative loop, using recursion will unnecessarliy involve extra space used by recursive stack and additionaly time involved in pushing and popping of activation reocrds, function calling overheads