Category: Python Programs

python tutorials and learn python

Created with Sketch.

Python program to create and display a doubly linked list.

Python program to create and display a doubly linked list. In this program, we will create a doubly linked list and print all the nodes present in the list. Doubly Linked List: Doubly Linked List is a variation of the linked list. The linked list is a linear data structure which can be described as…
Read more

Python program to create a doubly linked list of n nodes and display it in reverse order.

Python program to create a doubly linked list of n nodes and display it in reverse order. In this program, we create a doubly linked list and then reverse the list by reversing the direction of the list and print out the nodes. Traverse through the list by swapping the previous pointer with next pointer…
Read more

Python program to create a doubly linked list of n nodes and count the number of nodes.

Python program to create a doubly linked list of n nodes and count the number of nodes. In this program, we will create a doubly linked list and count the number of nodes present in the list. To count the node, we traverse through the list by incrementing the counter by 1. What count of…
Read more

Python program to create a doubly linked list from a ternary tree.

Python Program to Create a Doubly Linked List from a Ternary Tree In this comprehensive blog post, we will delve into the world of ternary trees and explore how to create a doubly linked list from a ternary tree using Python. The article aims to provide a clear understanding of the logic behind the solution…
Read more

Python program to convert a given binary tree to doubly linked list.

Python program to convert a given binary tree to doubly linked list. In this program, we need to convert the given binary tree to corresponding doubly liked list. The binary tree is a tree data structure in which each node has at most two children node. This can be achieved by traversing the tree in…
Read more

Python program to sort the elements of the Circular Linked List

Python program to sort the elements of the Circular Linked List In this program, we will create a circular linked list and sort the list in ascending order. In this example, we maintain two nodes: current which will point to head and index which will point to the next node to current. The first loop,…
Read more

Python program to search an element in a Circular Linked List

Python program to search an element in a Circular Linked List In this program, we create a circular linked list and search a node in the list. 9->5->2->7->3 9->5->2->7->3<br /> Consider, above example. Suppose we need to search for node 5. To solve this problem, we will iterate through the list and compare each node…
Read more

Python program to remove duplicate elements from a Circular Linked List

Python program to remove duplicate elements from a Circular Linked List In this program, we will create a circular linked list and remove duplicate nodes from the list. We will compare a node with the rest of the list and check for the duplicate. If the duplicate is found, delete the duplicate node from the…
Read more

Python program to insert a new node at the middle of the Circular Linked List

Python program to insert a new node at the middle of the Circular Linked List In this program, we create a circular linked list and insert a new node in the middle of the list. If the list is empty, both head and tail will point to the new node. If the list is not…
Read more

Python program to insert a new node at the end of the Circular Linked List

Python program to insert a new node at the end of the Circular Linked List In this program, we will create a circular linked list and insert every new node at the end of the list. If the list is empty, then head and tail will point to the newly added node. If the list…
Read more