AmitDiwan has Published 10744 Articles

Python program to create and display a doubly linked list

AmitDiwan

AmitDiwan

Updated on 11-Mar-2021 11:54:25

793 Views

When it is required to create and display the elements in a doubly linked list, a ‘Node’ class needs to be created. In this class, there are three attributes, the data that is present in the node, the access to the next node of the linked list, and the access ... Read More

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

AmitDiwan

AmitDiwan

Updated on 11-Mar-2021 11:52:06

251 Views

When it is required to create a doubly linked list and display the elements in a reversed order, a ‘Node’ class needs to be created. In this class, there are three attributes, the data that is present in the node, the access to the next node of the linked list, ... Read More

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

AmitDiwan

AmitDiwan

Updated on 11-Mar-2021 11:47:48

162 Views

When it is required to count the number of nodes in a doubly linked list, a ‘Node’ class needs to be created. In this class, there are three attributes, the data that is present in the node, the access to the next node of the linked list, and the access ... Read More

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

AmitDiwan

AmitDiwan

Updated on 11-Mar-2021 11:43:34

173 Views

When it is required to create a doubly linked list from a ternary tree, a ‘Node’ class needs to be created. In this class, there are two attributes, the data that is present in the node, and the access to the next node of the linked list.Another ‘linked_list’ class needs ... Read More

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

AmitDiwan

AmitDiwan

Updated on 11-Mar-2021 11:36:30

205 Views

When it is required to convert a given binary tree to a doubly linked list, a ‘Node’ class needs to be created. In this class, there are two attributes, the data that is present in the node, and the access to the next node of the linked list.Another ‘linked_list’ class ... Read More

Python program to sort the elements of the Circular Linked List

AmitDiwan

AmitDiwan

Updated on 11-Mar-2021 11:31:34

257 Views

When it is required to sort the elements of a circular linked list, a ‘Node’ class needs to be created. In this class, there are two attributes, the data that is present in the node, and the access to the next node of the linked list.In a circular linked list, ... Read More

Python program to search an element in a Circular Linked List

AmitDiwan

AmitDiwan

Updated on 11-Mar-2021 11:27:48

384 Views

When it is required to search for an element in a circular linked list, a ‘Node’ class needs to be created. In this class, there are two attributes, the data that is present in the node, and the access to the next node of the linked list.In a circular linked ... Read More

How to get unique elements in nested tuple in Python

AmitDiwan

AmitDiwan

Updated on 11-Mar-2021 10:05:04

2K+ Views

When it is required to get the unique elements in a nested tuple, a nested loop and the 'set' operator can be used.Python comes with a datatype known as 'set'. This 'set' contains elements that are unique only.The set is useful in performing operations such as intersection, difference, union and ... Read More

Multiply Adjacent elements in Python

AmitDiwan

AmitDiwan

Updated on 11-Mar-2021 10:04:24

742 Views

When it is required to multiply adjacent elements, the 'zip' method, the 'tuple' method, and the generator expression can be used.The zip method takes iterables, aggregates them into a tuple, and returns it as the result.Generator is a simple way of creating iterators. It automatically implements a class with '__iter__()' ... Read More

Check if variable is tuple in Python

AmitDiwan

AmitDiwan

Updated on 11-Mar-2021 10:01:45

3K+ Views

When it is required to check if a variable is a tuple, the 'type' method can be used.  A tuple is an immutable data type. It means, values once defined can't be changed by accessing their index elements. If we try to change the elements, it results in an error. ... Read More

Advertisements