# Category Archives: Python Programs

Given a singly linked list, swap kth node from beginning with kth node from end. Swapping of data is not allowed, only pointers should be… Read More
Given a 2D array, print it in reverse spiral form. We have already discussed Print a given matrix in spiral form. This article discusses how… Read More
Given K sorted linked lists of size N each, merge them and print the sorted output. Examples:  Input: k = 3, n = 4 list1… Read More
Given two numbers represented by two lists, write a function that returns the sum list. The sum list is a list representation of the addition… Read More
Given a linked list and a value x, partition it such that all nodes less than x come first, then all nodes with a value… Read More
Given a linked list of coordinates where adjacent points either form a vertical line or a horizontal line. Delete points from the linked list which… Read More
Pre-requisite: Doubly Link List Set 1| Introduction and Insertion Write a function to delete a given node in a doubly-linked list. Original Doubly Linked List  Recommended:… Read More
Given a 2D array, the task is to print matrix in anti spiral form:Examples:   Output: 16 15 14 13 12 11 10 9 8 7… Read More
Merge sort is often preferred for sorting a linked list. The slow random-access performance of a linked list makes some other algorithms (such as quicksort)… Read More
Given a linked list and two keys in it, swap nodes for two given keys. Nodes should be swapped by changing links. Swapping data of… Read More
Given an array arr[0 … n-1] containing n positive integers, a subsequence of arr[] is called Bitonic if it is first increasing, then decreasing. Write… Read More
Given a linked list having two pointers in each node. The first one points to the next node of the list, however, the other pointer… Read More
We have already discussed 2 different ways to clone a linked list. In this post, one more simple method to clone a linked list is… Read More
Given three linked lists, say a, b and c, find one node from each list such that the sum of the values of the nodes… Read More
Example: Let the input string be “i like this program very much”. The function should change the string to “much very program this like i”… Read More