# Tag Archives: Python-Data-Structures

Python-Data-Structures

Given a linked list and two positions ‘m’ and ‘n’. The task is to rotate the sublist from position m to n, to the right… Read More
Given a linked list and a number n. Find the sum of the last n nodes of the linked list.Constraints: 0 <= n <= number… Read More
Given a singly linked list, find middle of the linked list and set middle node of the linked list at beginning of the linked list. Examples:… Read More
Given a singly linked list and an integer K, the task is to rotate the linked list clockwise to the right by K places.Examples:   Input:… Read More
Given a linked list, write a function to reverse every k nodes (where k is an input to the function). Examples: Input: 1->2->3->4->5->6->7->8->NULL and k =… Read More
Insert a node x after the nth node from the end in the given singly linked list. It is guaranteed that the list contains the… Read More
Write a function detectAndCountLoop() that checks whether a given Linked List contains loop and if loop is present then returns count of nodes in loop.… Read More
Given a doubly linked list, rotate the linked list counter-clockwise by N nodes. Here N is a given positive integer and is smaller than the… Read More
Given a singly linked list containing n nodes. The problem is to sort the list using the recursive selection sort technique. The approach should be… Read More
Given a linked list of 0s, 1s and 2s, sort it.Examples: Input: 2->1->2->1->1->2->0->1->0 Output: 0->0->1->1->1->1->2->2->2 The sorted Array is 0, 0, 1, 1, 1, 1,… Read More
Given a linked list and a key in it, the task is to move all occurrences of the given key to the end of the… Read More
This tutorial is a beginner-friendly guide for learning data structures and algorithms using Python. In this article, we will discuss the in-built data structures such… Read More
Given a linked list where every node represents a linked list and contains two pointers of its type:  Pointer to next node in the main… Read More
QuickSort on Doubly Linked List is discussed here. QuickSort on Singly linked list was given as an exercise. The important things about implementation are, it… Read More
Write a function that searches a given key ‘x’ in a given singly linked list. The function should return true if x is present in… Read More