Definition : A linked list is a linear data structure, in which the elements are not stored at contiguous memory locations. The elements in a linked list are linked using pointers(entity that point to the next element)
In simple words, a linked list consists of nodes where each node contains a data field and a reference(link) to the next node in the list.
Some important terms in Linked List DS -
- Node/Link/Element/Object - Each node in the linked list consists of 2 parts -
a) data
b) link to the next node
- Next - This points to the next node/element in the linked list (since they are not stored in a contiguous memory locations)
Following are the standard Linked List Operations -
- Traversing a linked list.
- Append a new node (to the end) of a list
- Prepend a new node (to the beginning) of the list
- Inserting a new node to a specific position on the list
- Deleting a node from the list
Types of Linked List -
- Singly Linked List
- Doubly Linked List
- Circular Linked List
Applications of Linked List -
- Linked Lists can be used to implement Stacks , Queues.
- Linked Lists can also be used to implement Graphs. (Adjacency list representation of Graph).
- Implementing Hash Tables :- Each Bucket of the hash table can itself be a linked list. (Open chain hashing).
- Undo functionality in Photoshop or Word . Linked list of states
#linkedlist #linkedlistdatastructure #datastructures #linkedlistds #linkedlistoperations
#linkedlist