From c3c3f77c7da82929e22ec4dfed87d038bdd4e100 Mon Sep 17 00:00:00 2001 From: ravvahemanth Date: Sun, 13 Oct 2024 12:45:35 +0530 Subject: [PATCH] add content to the linked list --- docs/linked-list.md | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/docs/linked-list.md b/docs/linked-list.md index 0063cb9..86ad542 100644 --- a/docs/linked-list.md +++ b/docs/linked-list.md @@ -4,4 +4,36 @@ title: Linked list sidebar_label: Linked list --- -[Open a pull request](https://github.com/AllAlgorithms/algorithms/tree/master/docs/linked-list.md) to add the content for this algorithm. \ No newline at end of file +**A linked list** is a linear data structure where elements, called nodes, are stored in a sequence. Each node contains two parts: + +Data: The actual value or information stored in the node. +Pointer (or Reference): A reference or pointer to the next node in the list. + +## Types of Linked Lists : + +There are several variations of linked lists: + +## Singly Linked List: + +Structure: Each node contains data and a pointer to the next node. +Characteristics: Traversal is possible only in one direction (from the head to the tail). + + + + + +## Doubly Linked List: + +Structure: Each node contains three parts—data, a pointer to the next node, and a pointer to the previous node. +Characteristics: Traversal is possible in both directions (forward and backward). + + + +## Circular Linked List: + +Structure: Similar to a singly or doubly linked list, but the last node's next pointer refers to the first node instead of being null. +Characteristics: No null references at the end; it forms a circular chain. +In circular singly linked list: the last node points back to the head. +In circular doubly linked list: both the first node's previous pointer and the last node's next pointer connect, forming a loop. + + \ No newline at end of file