Blog

python tutorials and learn python

Created with Sketch.

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

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

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

Python program to find the maximum and minimum value node from a circular linked list

Python program to find the maximum and minimum value node from a circular linked list In this program, we will create a circular linked list then, iterate through the list to find out the minimum and maximum node. 9->5->2->7->3 9->5->2->7->3<br /> We will maintain two variables min and max. Min will hold the minimum value…
Read more

Python program to delete a node from the middle of the Circular Linked List

Python program to delete a node from the middle of the Circular Linked List In this program, we will create a circular linked list and delete a node from the middle of the list. If the list is empty, display the message “List is empty”. If the list is not empty, we will calculate the…
Read more