# Category Archives: Data Structures

Given an array containing only 0s and 1s, find the largest subarray which contains equal no of 0s and 1s. The expected time complexity is… Read More
Given a string, a partitioning of the string is a palindrome partitioning if every substring of the partition is a palindrome. For example, “aba|b|bbabb|a|b|aba” is… Read More
Given a Binary Tree, convert it to a Binary Search Tree. The conversion must be done in such a way that keeps the original structure… Read More
In the previous post, we discussed how a Doubly Linked can be created using only one space for the address field with every node. In… Read More
Given an array of n integers, find the 3 elements such that a[i] < a[j] < a[k] and i < j < k in 0(n)… Read More
The Floyd Warshall Algorithm is for solving all pairs of shortest-path problems. The problem is to find the shortest distances between every pair of vertices… Read More
In a party of N people, only one person is known to everyone. Such a person may be present at the party, if yes, (s)he… Read More
Given two Binary Search Trees(BST), print the inorder traversal of merged BSTs.  Examples: Input: First BST        3    /     \ 1    … Read More
Pattern searching is an important problem in computer science. When we do search for a string in a notepad/word file, browser, or database, pattern searching… Read More
Given an unsorted array that contains even number of occurrences for all numbers except two numbers. Find the two numbers which have odd occurrences in… Read More
Given an unsorted array arr[] with both positive and negative elements, the task is to find the smallest positive number missing from the array. Note:… Read More
Given an array and a value, find if there is a triplet in array whose sum is equal to the given value. If there is… Read More
Given an array of random numbers. Find the longest increasing subsequence (LIS) in the array. I know many of you might have read recursive and dynamic… Read More
Given an array of n positive integers. Write a program to find the sum of maximum sum subsequence of the given array such that the… Read More
Given an array arr[] of non-negative integers and an integer sum, find a subarray that adds to a given sum. Note: There may be more than… Read More