diff --git a/Algorithms_and_Data_Structures/Linked List/Menu_Driven_Code_for_Circular_Doubly_LinkedList.py b/Algorithms_and_Data_Structures/Linked List/Menu_Driven_Code_for_Circular_Doubly_LinkedList.py new file mode 100644 index 0000000000..83e46f07c3 --- /dev/null +++ b/Algorithms_and_Data_Structures/Linked List/Menu_Driven_Code_for_Circular_Doubly_LinkedList.py @@ -0,0 +1,185 @@ +class Node: + """ + Node class for circular doubly linked list. + + Args: + data (int): The value to be stored in the node. + """ + + def __init__(self, data): + """ + Initializes a new node with the given data and sets the left and right pointers to None. + """ + self.data = data + self.right = None + self.left = None + + +class LinkedList: + """ + Circular Doubly Linked List implementation with various operations. + """ + + def __init__(self): + """ + Initializes an empty circular doubly linked list with root and last pointers set to None. + """ + self.root = None + self.last = None + + def insertLeft(self, data): + """ + Inserts a new node at the left (beginning) of the circular doubly linked list. + + Args: + data (int): The value to be inserted at the left. + """ + n = Node(data) + if self.root == None: + # If list is empty, initialize both root and last to the new node. + self.root = n + self.last = n + self.last.right = self.root + self.root.left = self.last + else: + # Insert the new node to the left of root and update pointers. + n.right = self.root + self.root.left = n + self.root = n + self.last.right = self.root + self.root.left = self.last + print('\nInserted Element: ', self.root.data) + self.printList() + + def deleteLeft(self): + """ + Deletes a node from the left (beginning) of the circular doubly linked list. + """ + if self.root == None: + print('\nLinked List is empty..!!') + else: + temp = self.root + if self.root == self.last: + # If there is only one node, set root and last to None. + self.root = None + else: + # Delete the root and update pointers. + self.root = self.root.right + self.root.left = self.last + self.last.right = self.root + print('\nDeleted element: ', temp.data) + self.printList() + + def insertRight(self, data): + """ + Inserts a new node at the right (end) of the circular doubly linked list. + + Args: + data (int): The value to be inserted at the right. + """ + n = Node(data) + if self.root == None: + # If list is empty, initialize both root and last to the new node. + self.root = n + self.last = n + self.last.right = self.root + self.root.left = self.last + else: + # Insert the new node to the right of the last node and update pointers. + self.last.right = n + n.left = self.last + self.last = n + self.last.right = self.root + self.root.left = self.last + print('\nInserted Element: ', n.data) + self.printList() + + def deleteRight(self): + """ + Deletes a node from the right (end) of the circular doubly linked list. + """ + if self.root == None: + print('\nLinked List is empty..!!') + else: + if self.root == self.last: + # If there is only one node, set root and last to None. + self.root = None + else: + # Delete the last node and update pointers. + print('Deleted Element: ', self.last.data) + self.last = self.last.left + self.last.right = self.root + self.root.left = self.last + self.printList() + + def printList(self): + """ + Prints all elements in the circular doubly linked list in forward order. + """ + if self.root == None: + print('\nLinked List is empty..!!') + return + temp = self.root + print('\nElements in Linked List are: ') + while True: + print('|', temp.data, '| <-> ', end='') + temp = temp.right + if temp == self.root: + break + print('Root') + print() + + def printReverseList(self): + """ + Prints all elements in the circular doubly linked list in reverse order. + """ + if self.root == None: + print('\nLinked List is empty..!!') + return + temp = self.last + print('\nElements in Linked List are: ') + while True: + print('|', temp.data, '| <-> ', end='') + temp = temp.left + if temp == self.last: + break + print('Last') + print() + + +# Main menu-driven code to interact with the linked list. +o = LinkedList() + +while True: + print('----------------------') + print('\n1. Insert from Left\n2. Insert from Right\n3. Delete from Left\n4. Delete from Right\n5. Print Linked List\n6. Print Reverse Linked List\n0. Exit') + print('----------------------') + + ch = int(input('\nEnter your choice: ')) + + if ch == 1: + data = int(input('\nEnter value to be inserted in left: ')) + o.insertLeft(data) + + elif ch == 2: + data = int(input('\nEnter value to be inserted in right: ')) + o.insertRight(data) + + elif ch == 3: + o.deleteLeft() + + elif ch == 4: + o.deleteRight() + + elif ch == 5: + o.printList() + + elif ch == 6: + o.printReverseList() + + elif ch == 0: + print('You are out of the program..!!') + break + + else: + print('\nWrong Input..\nEnter the correct choice..!!\n') diff --git a/Algorithms_and_Data_Structures/Linked List/Menu_Driven_Code_for_Circular_LinkedList.py b/Algorithms_and_Data_Structures/Linked List/Menu_Driven_Code_for_Circular_LinkedList.py new file mode 100644 index 0000000000..d454b46b3c --- /dev/null +++ b/Algorithms_and_Data_Structures/Linked List/Menu_Driven_Code_for_Circular_LinkedList.py @@ -0,0 +1,156 @@ +class Node: + """ + Node class for Circular Linked List. + + Args: + data (int): The value to be stored in the node. + """ + def __init__(self, data): + """ + Initializes a new node with the given data and sets the next pointer to None. + + Args: + data (int): The data to store in the node. + """ + self.data = data + self.next = None + + +class LinkedList: + """ + Circular Linked List implementation with insertion, deletion, and print operations. + """ + def __init__(self): + """ + Initializes an empty circular linked list with root and last pointers set to None. + """ + self.root = None + self.last = None + + def insertLeft(self, data): + """ + Inserts a new node at the left (beginning) of the circular linked list. + + Args: + data (int): The value to be inserted at the left. + """ + n = Node(data) + if self.root == None: + # If the list is empty, initialize both root and last to the new node. + self.root = n + self.last = n + self.last.next = self.root + else: + # Insert the new node at the beginning and update root and last.next. + n.next = self.root + self.root = n + self.last.next = self.root + + def deleteLeft(self): + """ + Deletes a node from the left (beginning) of the circular linked list. + """ + if self.root == None: + print('\nLinked List is empty..!!') + else: + temp = self.root + if self.root == self.last: + # If there is only one node, set root and last to None. + self.last = self.root = None + else: + # Update root to the next node and adjust the last.next pointer. + self.root = self.root.next + self.last.next = self.root + print('\nDeleted element: ', temp.data) + + def insertRight(self, data): + """ + Inserts a new node at the right (end) of the circular linked list. + + Args: + data (int): The value to be inserted at the right. + """ + n = Node(data) + if self.root == None: + # If the list is empty, initialize both root and last to the new node. + self.root = n + self.last = n + self.last.next = self.root + else: + # Insert the new node at the end and update last and last.next. + self.last.next = n + self.last = n + self.last.next = self.root + + def deleteRight(self): + """ + Deletes a node from the right (end) of the circular linked list. + """ + if self.root == None: + print('\nLinked List is empty..!!') + else: + if self.root == self.last: + # If there is only one node, set root and last to None. + self.root = self.last = None + else: + # Traverse to the second-last node and update last to the second-last node. + temp = self.root + temp2 = self.root + while temp.next != self.root: + temp2 = temp + temp = temp.next + self.last = temp2 + temp2.next = self.root + print('\nDeleted element: ', temp.data) + + def printList(self): + """ + Prints all elements in the circular linked list in forward order. + """ + if self.root == None: + print('\nLinked List is empty..!!') + return + temp = self.root + print('\nElements in Linked List are: ') + while True: + print('|', temp.data, '| -> ', end='') + temp = temp.next + if temp == self.root: + break + print('None') + print() + + +# Main menu-driven code to interact with the linked list. +o = LinkedList() + +while True: + print('----------------------') + print('\n1. Insert from Left\n2. Insert from Right\n3. Delete from Left\n4. Delete from Right\n5. Print Linked List\n0. Exit') + print('----------------------') + + ch = int(input('\nEnter your choice: ')) + + if ch == 1: + data = int(input('\nEnter value to be inserted in left: ')) + o.insertLeft(data) + + elif ch == 2: + data = int(input('\nEnter value to be inserted in right: ')) + o.insertRight(data) + + elif ch == 3: + o.deleteLeft() + + elif ch == 4: + o.deleteRight() + + elif ch == 5: + o.printList() + + elif ch == 0: + print('You are out of the program..!!') + break + + else: + print('\nWrong Input..\nEnter the correct choice..!!\n') diff --git a/Algorithms_and_Data_Structures/Linked List/Menu_Driven_Code_for_Doubly_LinkedList.py b/Algorithms_and_Data_Structures/Linked List/Menu_Driven_Code_for_Doubly_LinkedList.py new file mode 100644 index 0000000000..eefbe1dac3 --- /dev/null +++ b/Algorithms_and_Data_Structures/Linked List/Menu_Driven_Code_for_Doubly_LinkedList.py @@ -0,0 +1,176 @@ +class Node: + """ + Node class for the Doubly Linked List. + + Args: + data (int): The value to be stored in the node. + """ + def __init__(self, data): + """ + Initializes a new node with the given data and sets the right and left pointers to None. + + Args: + data (int): The data to store in the node. + """ + self.data = data + self.right = None + self.left = None + + +class LinkedList: + """ + Doubly Linked List implementation with insertion, deletion, and traversal operations. + """ + def __init__(self): + """ + Initializes an empty doubly linked list with root and last pointers set to None. + """ + self.root = None + self.last = None + + def insertLeft(self, data): + """ + Inserts a new node at the left (beginning) of the doubly linked list. + + Args: + data (int): The value to be inserted at the left. + """ + n = Node(data) + if self.root == None: + # If the list is empty, initialize root to the new node. + self.root = n + else: + # Insert the new node at the beginning and update root and the pointers. + n.right = self.root + self.root.left = n + self.root = n + + def deleteLeft(self): + """ + Deletes a node from the left (beginning) of the doubly linked list. + """ + if self.root == None: + print('\nLinked List is empty..!!') + else: + temp = self.root + if self.root.right == self.root.left == None: + # If only one node is present, set root to None. + self.root = None + else: + # Update root to the next node. + self.root = self.root.right + self.root.left = None + print('Deleted: ', temp.data) + + def insertRight(self, data): + """ + Inserts a new node at the right (end) of the doubly linked list. + + Args: + data (int): The value to be inserted at the right. + """ + n = Node(data) + if self.root == None: + # If the list is empty, initialize root to the new node. + self.root = n + else: + # Traverse to the end of the list and insert the new node. + temp = self.root + while temp.right != None: + temp = temp.right + temp.right = n + n.left = temp + print('Inserted Element: ', n.data) + + def deleteRight(self): + """ + Deletes a node from the right (end) of the doubly linked list. + """ + if self.root == None: + print('\nLinked List is empty..!!') + else: + if self.root.right == self.root.left: + # If only one node is present, set root to None. + self.root = None + else: + # Traverse to the last node and delete it. + temp = self.root + while temp.right != None: + temp = temp.right + print('\nDeleted: ', temp.data) + temp = temp.left + temp.right = None + + def printList(self): + """ + Prints all elements in the doubly linked list in forward order. + """ + if self.root == None: + print('\nLinked List is empty..!!') + return + else: + temp = self.root + print('Elements of linked list are: ') + while temp != None: + print('|', temp.data, ' <-> ', end=" ") + temp = temp.right + print('None') + print('') + + def printListReverse(self): + """ + Prints all elements in the doubly linked list in reverse order. + """ + if self.root == None: + print('\nLinked List is empty..!!') + return + else: + temp = self.root + # Traverse to the last node + while temp.right != None: + temp = temp.right + # Traverse back to the first node and print elements + print('Elements of linked list are: ') + while temp != None: + print('|', temp.data, ' <-> ', end=" ") + temp = temp.left + print('None') + print('') + + +# Main menu-driven code to interact with the linked list. +o = LinkedList() + +while True: + print('----------------------') + print('\n1. Insert from Left\n2. Insert from Right\n3. Delete from Left\n4. Delete from Right\n5. Print Linked List\n6. Print Reverse Linked List\n0. Exit') + print('----------------------') + + ch = int(input('\nEnter your choice: ')) + + if ch == 1: + data = int(input('\nEnter value to be inserted in left: ')) + o.insertLeft(data) + + elif ch == 2: + data = int(input('\nEnter value to be inserted in right: ')) + o.insertRight(data) + + elif ch == 3: + o.deleteLeft() + + elif ch == 4: + o.deleteRight() + + elif ch == 5: + o.printList() + + elif ch == 6: + o.printListReverse() + + elif ch == 0: + print('You are out of the program..!!') + break + + else: + print('\nWrong Input..\nEnter the correct choice..!!\n') diff --git a/Algorithms_and_Data_Structures/Linked List/Menu_Driven_Code_for_Dynamic_Linear_Queue_using_LinkedList.py b/Algorithms_and_Data_Structures/Linked List/Menu_Driven_Code_for_Dynamic_Linear_Queue_using_LinkedList.py new file mode 100644 index 0000000000..e70e97e29c --- /dev/null +++ b/Algorithms_and_Data_Structures/Linked List/Menu_Driven_Code_for_Dynamic_Linear_Queue_using_LinkedList.py @@ -0,0 +1,109 @@ +class Node: + """ + Node class for the Dynamic Queue. + + Args: + data (int): The value to be stored in the node. + """ + def __init__(self, data): + """ + Initializes a new node with the given data and sets the next pointer to None. + + Args: + data (int): The data to store in the node. + """ + self.data = data + self.next = None + + +class DynamicQueue: + """ + Dynamic Queue implementation using linked list structure for efficient memory management. + """ + def __init__(self): + """ + Initializes an empty queue with front and rear pointers set to None. + """ + self.front = None + self.rear = None + + def enqueue(self, data): + """ + Adds a new element to the rear of the queue. + + Args: + data (int): The value to be enqueued. + """ + n = Node(data) + if self.front == None: + # If queue is empty, both front and rear point to the new node. + self.front = self.rear = n + else: + # Add the new node at the rear and update the rear pointer. + self.rear.next = n + self.rear = n + print('\nElement Enqueued in Queue: ', data) + + def dequeue(self): + """ + Removes an element from the front of the queue. + """ + if self.front == None: + # If queue is empty, print a message. + print('\nQueue is empty..!!') + else: + # Remove the front element and move the front pointer to the next node. + temp = self.front + self.front = self.front.next + print('\nElement Dequeued from Queue: ', temp.data) + # If the queue is now empty, reset the rear to None. + if self.front == None: + self.rear = None + + def printQueue(self): + """ + Prints all elements in the queue. + """ + if self.front == None: + # If queue is empty, print a message. + print('\nQueue is empty..!!') + else: + # Traverse from front to rear and print each element. + temp = self.front + while temp != None: + print(temp.data, ' --> ', end='') + temp = temp.next + print() + + +# Main menu-driven code to interact with the dynamic queue. +o = DynamicQueue() + +while True: + print('-----------') + print('\n1. Enqueue\n2. Dequeue\n3. Print\n0. Exit') + print('-----------') + + ch = int(input('\nEnter your choice: ')) + + if ch == 1: + # Enqueue operation + data = int(input('\nEnter value to enqueue in Queue: ')) + o.enqueue(data) + + elif ch == 2: + # Dequeue operation + o.dequeue() + + elif ch == 3: + # Print queue elements + o.printQueue() + + elif ch == 0: + # Exit the program + print('You are out of the program..!!') + break + + else: + # Handle incorrect input + print('\nWrong Input..\nEnter the correct choice..!!\n') diff --git a/Algorithms_and_Data_Structures/Linked List/Menu_Driven_Code_for_Dynamic_Stack_using_LinkedList.py b/Algorithms_and_Data_Structures/Linked List/Menu_Driven_Code_for_Dynamic_Stack_using_LinkedList.py new file mode 100644 index 0000000000..2293c482ac --- /dev/null +++ b/Algorithms_and_Data_Structures/Linked List/Menu_Driven_Code_for_Dynamic_Stack_using_LinkedList.py @@ -0,0 +1,119 @@ +class Node: + """ + Node class to represent each element in the stack. + + Args: + data (int): The value to be stored in the node. + """ + def __init__(self, data): + """ + Initializes a new node with the given data and sets the next pointer to None. + + Args: + data (int): The data to store in the node. + """ + self.data = data + self.next = None + + +class DynamicStack: + """ + Dynamic Stack implementation using a linked list structure. + """ + def __init__(self): + """ + Initializes an empty stack with tos (Top of Stack) set to None. + """ + self.tos = None + + def push(self, data): + """ + Pushes a new element onto the stack. + + Args: + data (int): The value to be pushed onto the stack. + """ + n = Node(data) + if self.tos == None: + # If stack is empty, set tos to the new node. + self.tos = n + else: + # Otherwise, insert the new node on top and update tos. + n.next = self.tos + self.tos = n + + def pop(self): + """ + Removes the top element from the stack. + """ + if self.tos == None: + # If stack is empty, print a message. + print('\nStack is empty..!!') + else: + # Remove the top element and update tos to the next element. + temp = self.tos + self.tos = self.tos.next + print('Popped Element from Stack: ', temp.data) + + def peek(self): + """ + Returns the top element of the stack without removing it. + """ + if self.tos == None: + # If stack is empty, print a message. + print('\nStack is empty..!!') + else: + # Display the top element. + print('Peeked Element: ', self.tos.data) + + def printStack(self): + """ + Prints all elements in the stack. + """ + if self.tos == None: + # If stack is empty, print a message. + print('\nStack is empty..!!') + else: + # Traverse from top to bottom and print each element. + print('Stack Data:') + temp = self.tos + while temp != None: + print(temp.data) + temp = temp.next + + +# Main code with menu-driven interaction +o = DynamicStack() + +while True: + print('-----------') + print('\n1. Push\n2. Pop\n3. Peek\n4. Print\n0. Exit') + print('-----------') + + ch = int(input('\nEnter your choice: ')) + + if ch == 1: + # Push operation + data = int(input('\nEnter value to push in stack: ')) + o.push(data) + + elif ch == 2: + # Pop operation + o.pop() + + elif ch == 3: + # Peek operation + o.peek() + + elif ch == 4: + # Print all stack elements + o.printStack() + + elif ch == 0: + # Exit the program + print('You are out of the program..!!') + break + + else: + # Handle incorrect input + print('\nWrong Input..\nEnter the correct choice..!!\n') diff --git a/Algorithms_and_Data_Structures/Linked List/Menu_Driven_Code_for_Linear_LinkedList.py b/Algorithms_and_Data_Structures/Linked List/Menu_Driven_Code_for_Linear_LinkedList.py new file mode 100644 index 0000000000..47d1ab36c1 --- /dev/null +++ b/Algorithms_and_Data_Structures/Linked List/Menu_Driven_Code_for_Linear_LinkedList.py @@ -0,0 +1,204 @@ +class Node: + """ + Node class to represent each element in the linked list. + + Args: + data (int): The value to be stored in the node. + """ + def __init__(self, data): + """ + Initializes a new node with the given data and sets the next pointer to None. + """ + self.data = data + self.next = None + + +class LinkedList: + """ + Linked list implementation with insert, delete, search, and traversal functions. + """ + def __init__(self): + """ + Initializes an empty linked list with root set to None. + """ + self.root = None + + def insertLeft(self, data): + """ + Inserts an element at the beginning of the linked list. + + Args: + data (int): The value to be inserted. + """ + n = Node(data) + if self.root == None: + # If the list is empty, make the new node the root. + self.root = n + else: + # Insert the new node at the beginning. + n.next = self.root + self.root = n + + def deleteLeft(self): + """ + Deletes the element from the beginning of the linked list. + """ + if self.root == None: + print('\nLinked List is empty..!!') + else: + # Remove the first node and update the root to the next node. + temp = self.root + self.root = self.root.next + print('\nDeleted element: ', temp.data) + + def insertRight(self, data): + """ + Inserts an element at the end of the linked list. + + Args: + data (int): The value to be inserted. + """ + n = Node(data) + if self.root == None: + # If the list is empty, make the new node the root. + self.root = n + else: + # Traverse to the end of the list and insert the new node. + temp = self.root + while temp.next != None: + temp = temp.next + temp.next = n + + def deleteRight(self): + """ + Deletes the element from the end of the linked list. + """ + if self.root == None: + print('\nLinked List is empty..!!') + else: + # Traverse to the end and remove the last node. + temp = self.root + temp2 = self.root + while temp.next != None: + temp2 = temp + temp = temp.next + temp2.next = None + if temp == self.root: + self.root = None + print('\nDeleted element: ', temp.data) + + def printList(self): + """ + Prints all elements in the linked list. + """ + if self.root == None: + print('\nLinked List is empty..!!') + else: + temp = self.root + print('\nElements in Linked List are: ') + while temp != None: + print('|', temp.data, '| -> ', end='') + temp = temp.next + print('None\n') + + def searchList(self, data): + """ + Searches for an element in the linked list. + + Args: + data (int): The value to search for. + """ + if self.root == None: + print('\nLinked List is empty..!!') + else: + # Traverse through the list to find the element. + count = 0 + temp = self.root + while temp != None: + if temp.data == data: + print('\nElement', data, 'found at node: ', count) + return + temp = temp.next + count += 1 + print('\nElement not found') + + def deleteElement(self, data): + """ + Deletes a specific element from the linked list. + + Args: + data (int): The value to be deleted. + """ + if self.root == None: + print('\nLinked List is empty..!!') + else: + # Traverse to find the element and remove it from the list. + count = 0 + temp = self.root + temp2 = self.root + while temp != None and temp.data != data: + temp2 = temp + temp = temp.next + count += 1 + if temp != None: + if temp == self.root: + self.root = self.root.next + elif temp.next == None: + temp2.next = None + else: + temp2.next = temp.next + print('\nDeleted Element:', temp.data, 'from position: ', count) + else: + print(data, 'not found in Linked List') + + +# Menu-driven interaction to perform linked list operations. +o = LinkedList() + +while True: + print('----------------------') + print('\n1. Insert from Left\n2. Insert from Right\n3. Delete from Left\n4. Delete from Right\n5. Delete Element x\n6. Print Linked List\n7. Search Element x\n0. Exit') + print('----------------------') + + ch = int(input('\nEnter your choice: ')) + + if ch == 1: + # Insert at the beginning of the list. + data = int(input('\nEnter value to be inserted in left: ')) + o.insertLeft(data) + + elif ch == 2: + # Insert at the end of the list. + data = int(input('\nEnter value to be inserted in right: ')) + o.insertRight(data) + + elif ch == 3: + # Delete from the beginning of the list. + o.deleteLeft() + + elif ch == 4: + # Delete from the end of the list. + o.deleteRight() + + elif ch == 5: + # Delete a specific element. + x = int(input('\nEnter the value of Element x: ')) + o.deleteElement(x) + + elif ch == 6: + # Print the entire list. + o.printList() + + elif ch == 7: + # Search for a specific element. + data = int(input('Enter the value of Element x: ')) + o.searchList(data) + + elif ch == 0: + # Exit the program. + print('You are out of the program..!!') + break + + else: + # Handle incorrect input. + print('\nWrong Input..\nEnter the correct choice..!!\n') diff --git a/Algorithms_and_Data_Structures/Linked List/README.md b/Algorithms_and_Data_Structures/Linked List/README.md new file mode 100644 index 0000000000..b417d5ab7d --- /dev/null +++ b/Algorithms_and_Data_Structures/Linked List/README.md @@ -0,0 +1,61 @@ +# **Linked List** +Linked lists are a fundamental data structure that allows efficient storage and manipulation of data + + +## **Explanation** + +1. ### **Linear Linked List** + A linear linked list consists of a sequence of nodes, where each node contains data and a pointer to the next node. The menu-driven code for a linear linked list typically includes options to perform operations such as inserting a node, deleting a node, searching for a specific value, displaying the list, and exiting the program. + + 🔗 View here: [Linear Linked List](./Menu_Driven_Code_for_Linear_LinkedList.py) + + +2. ### **Doubly Linked List** + A doubly linked list extends the concept of a linear linked list by including an additional pointer in each node, pointing to the previous node. The menu-driven code for a doubly linked list provides options for inserting, deleting, searching, displaying, and exiting, similar to a linear linked list. However, due to the presence of backward links, the code must handle operations involving both forward and backward traversal. + + 🔗 View here: [Doubly Linked List](./Menu_Driven_Code_for_Doubly_LinkedList.py) + + +3. ### **Circular Linked List** + In a circular linked list, the last node points back to the first node, creating a circular structure. The menu-driven code for a circular linked list offers operations such as insertion, deletion, searching, displaying, and exiting. Care must be taken to correctly handle the circular nature of the list when performing operations like traversal or deletion. + + 🔗 View here: [Circular Linked List](./Menu_Driven_Code_for_Circular_LinkedList.py) + + +4. ### **Circular Doubly Linked List** + A circular doubly linked list combines the properties of a circular linked list and a doubly linked list. Each node has a forward and backward pointer, and the last node connects back to the first node. The menu-driven code for a circular doubly linked list allows operations like insertion, deletion, searching, displaying, and exiting, taking into account both forward and backward traversal. + + 🔗 View here: [Circular Doubly Linked List](./Menu_Driven_Code_for_Circular_Doubly_LinkedList.py) + + +5. ### **Dynamic Linear Queue using Linked List** + A dynamic linear queue implemented using a linked list provides a queue data structure with dynamic memory allocation. The menu-driven code for this structure includes options for enqueueing (adding) elements, dequeuing (removing) elements, displaying the queue, checking if it is empty, checking if it is full, and exiting. + + 🔗 View here: [Dynamic Linear Queue using Linked List](./Menu_Driven_Code_for_Dynamic_Linear_Queue_using_LinkedList.py) + + +6. ### **Dynamic Stack using Linked List** + A dynamic stack implemented using a linked list allows the creation of a stack with dynamic memory allocation. The menu-driven code for a dynamic stack provides options for pushing (adding) elements, popping (removing) elements, displaying the stack, checking if it is empty, checking if it is full, and exiting. + + 🔗 View here: [Dynamic Stack using Linked List](./Menu_Driven_Code_for_Dynamic_Stack_using_LinkedList.py) + + +In each of these menu-driven linked list codes, you willbe presented with a menu of options to choose from, and the corresponding operations are performed based on their selections. This approach offers a convenient and user-friendly way to interact with linked lists and perform common operations without needing to write custom code for each functionality. + + +## **Setup Instructions** + +1. Install Python +2. Verify Python Installation + + ```bash + python --version + ``` + +3. Run the Python Script + ```bash + python filename.py + ``` + + Note: Replace `filename.py` with the name of the python file which is to be executed. +