Linked list in data structure

Linked list is a data structure that consists of a sequence of data records such that in each record there is a field that contains a reference (i.e.,a link) to the next record in the sequence.

In case of normal stack,

    -if a stack is too large,too many slots are wasted

    -if a stack is too small,it may become full too early

To overcome this disadvantage,dynamic memory allocation method is used.

In this case,

    -a single and simple linked list is used.

    -initially top pointer is initialized to NULL.

    -top pointer always points to first node of the list.

    -In case of push operation,new node is added before first node setting top pointer to new first node.

    -In case of pop operation,first node is deleted seting top pointer to next node in the list.