# Category Archives: Data Structures

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 an array of integers, sort the array according to frequency of elements. For example, if the input array is {2, 3, 2, 4, 5,… Read More
Given two strings ‘X’ and ‘Y’, find the length of the longest common substring.  Examples :  Input : X = “GeeksforGeeks”, y = “GeeksQuiz” Output :… Read More
Given string str, the task is to find the minimum number of characters to be inserted to convert it to a palindrome. Before we go… Read More
Following is a typical recursive implementation of QuickSort for arrays. The implementation uses last element as pivot.  C++ /* A typical recursive implementation of Quicksort… Read More
A Bipartite Graph is a graph whose vertices can be divided into two independent sets, U and V such that every edge (u, v) either… Read More
Given two binary strings that represent value of two integers, find the product of two strings. For example, if the first bit string is “1100”… Read More
The atoi() function in C takes a string (which represents an integer) as an argument and returns its value of type int. So basically the… 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. A… Read More
Given two strings where first string may contain wild card characters and second string is a normal string. Write a function that returns true if… Read More
Find the largest rectangular area possible in a given histogram where the largest rectangle can be made of a number of contiguous bars whose heights… Read More
Find the largest rectangular area possible in a given histogram where the largest rectangle can be made of a number of contiguous bars. For simplicity,… Read More
Given a Binary Tree (Bt), convert it to a Doubly Linked List(DLL). The left and right pointers in nodes are to be used as previous… Read More
A binary tree is a tree data structure in which each node can have at most two children, which are referred to as the left… Read More
The cost of a stock on each day is given in an array. Find the maximum profit that you can make by buying and selling… Read More