Applications of Linked Lists

Linked list is list of nodes connected by pointers. Each node stores data and pointer to next node. Linkedlist is a dynamic data structure, so size can be easily increased.

Few frequently used terms in linked list are:

Node
Head
Tail
Sentinel

Python implementation of the node is:

class ListNode(self, val):
def int(self, val):
self.val = val
self.next = next

The start of the linked list is called head, end of the list is tail, who's next pointer points to None. Sentinel node is a dummy node added at the head or tail of the list to make operations easier on the list.

There are three types of linked lists

  1. Singly linked list, have uni-directional pointers to next immediate node in unidirectional.

Applications of Linked Lists are:

  1. Linear linked lists are used to implement stacks. It would be FILO [first in last out] procedure to access data.

Time complexity of linked lists:

Search: O(n)
Insert: O(1)
Delete: O(n)

--

--

Curious Human, Software Developer and a Dog Lover

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store