# Category Archives: Python Programs

Given a list of integers, rearrange the list such that it consists of alternating minimum-maximum elements using only list operations. The first element of the… Read More
Given a linked list, rearrange it such that the converted list should be of the form a < b > c < d > e… Read More
Given a Linked List. The Linked List is in alternating ascending and descending orders. Sort the list efficiently.  Example:  Input List: 10 -> 40 ->… Read More
Depth First Traversal (or Search) for a graph is similar to Depth First Traversal of a tree. The only catch here is, unlike trees, graphs… Read More
Given a linked list, write a function to reverse every alternate k nodes (where k is an input to the function) in an efficient way.… Read More
Given a Roman numeral, the task is to find its corresponding decimal value. Example :  Input: IX Output: 9 IX is a Roman symbol which… Read More
Given a positive integer n which represents the dimensions of a 4n x 4n matrix with values from 1 to n filled from left to… Read More
Given a linked list, write a function to reverse every k nodes (where k is an input to the function).  Example:  Input: 1->2->3->4->5->6->7->8->NULL, K =… Read More
An array contains both positive and negative numbers in random order. Rearrange the array elements so that positive and negative numbers are placed alternatively. Number… Read More
We have introduced Linked Lists in the previous post. We also created a simple linked list with 3 nodes and discussed linked list traversal.All programs… Read More
Given an unsorted array of nonnegative integers, find a continuous subarray which adds to a given number. Examples :  Input: arr[] = {1, 4, 20, 3,… Read More
Rearrange a linked list in such a way that all odd position nodes are together and all even positions node are together, Examples:  Input: 1->2->3->4 Output:… Read More
Given a linked list, find the length of the longest palindrome list that exists in that linked list. Examples:   Input : List = 2->3->7->3->2->12->24 Output :… Read More
Given a singly linked list of characters, write a function that returns true if the given list is a palindrome, else false. Recommended: Please solve… Read More
Given two strings, represented as linked lists (every character is a node in a linked list). Write a function compare() that works similar to strcmp(),… Read More