Singly Linked List – Creation (LIFO, FIFO, Sorted)

Singly Linked List

Creation of a Singly Linked List (LIFO, FIFO, Sorted)

Creation of a linked list may be in any order say LIFO, FIFO or Sorted.  If a linked list is created considering LIFO order, then insertions as well as deletions are done at the same end i.e. the last node of the linked list is the first one to be deleted.  If a linked list is created considering FIFO order, then insertions are done one end, whereas deletions are performed at the other end.  Thus, the first node to be deleted is only that node which is inserted first in the linked list.  However, creating a Sorted Linked List involves insertion of a new node in the linked list such that the order of the list is preserved.  The order to be retained in the list may be chosen as either ascending or descending order.