The Stable Marriage Problem states that given N men and N women, where each person has ranked all members of the opposite sex in order… Read More
In a flow network, an s-t cut is a cut that requires the source ‘s’ and the sink ‘t’ to be in different subsets, and… Read More
A matching in a Bipartite Graph is a set of the edges chosen in such a way that no two edges share an endpoint. A… Read More
filter_none edit close play_arrow link brightness_4 code #include<iostream> using namespace std; class X { public: int x; }; int main() { X a… Read More
Given a set of points in the plane. the convex hull of the set is the smallest convex polygon that contains all the points of… Read More
Given a polygon and a point ‘p’, find if ‘p’ lies inside the polygon or not. The points lying on the border are considered inside. … Read More
Given two line segments (p1, q1) and (p2, q2), find if the given line segments intersect with each other. Before we discuss solution, let us… Read More
Given a set of numbers, find the Length of the Longest Arithmetic Progression (LLAP) in it. Examples: set[] = {1, 7, 10, 15, 27, 29}… Read More
A car factory has two assembly lines, each with n stations. A station is denoted by Si,j where i is either 1 or 2 and… Read More
Given a graph which represents a flow network where every edge has a capacity. Also given two vertices source ‘s’ and sink ‘t’ in the… Read More
A sorted array is rotated at some unknown point, find the minimum element in it. The following solution assumes that all elements are distinct. Examples: Input:… Read More
Given a Binary Tree and a key, write a function that prints all the ancestors of the key in the given binary tree. For example,… 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
Given a set of characters and a positive integer k, print all possible strings of length k that can be formed from the given set.… Read More
QuickSort on Doubly Linked List is discussed here. QuickSort on Singly linked list was given as an exercise. Following is C++ implementation for same. The… Read More
Featured Articles
View All