Given array A[][2] of size M, form a new array B[] of size N, for every i from 1 to M we know BA[i][0] <… Read More
Tag Archives: Topological Sorting
Sorting refers to rearrangement of a given array or list of elements according to a comparison operator on the elements. The comparison operator is used… Read More
Topological sorting is a common problem in computer science that involves arranging the vertices of a directed acyclic graph (DAG) in a linear order such… Read More
Given a directed graph with N nodes and M connections shown in the matrix mat[] where each element is of the form {xi, yi} denoting… Read More
Given an integer N and an array arr[] of M pairs of type (Ai, Bi), the task is to generate the lexicographically smallest possible permutation… Read More
Given a 2D array arr[][] of size N*M which denotes N arrays, each of size M. The task is to check if all these arrays… Read More
Prerequisite: Conflict Serializability, Precedence Graph Conflict Serializable Schedule: A schedule is called conflict serializable if it can be transformed into a serial schedule by swapping… Read More
Given a Directed Acyclic Graph having V vertices and E edges, where each edge {U, V} represents the Jobs U and V such that Job… Read More
Given a Directed Graph consisting of N vertices and M edges and a set of Edges[][], the task is to check whether the graph contains… Read More
Given an array arr of distinct elements and a list of subsequences seqs of the array, the task is to check whether the given array… Read More
Given an array of pairs arr of size N which represents a game situation where the first player wins against the second player. Given multiple… Read More
Given a directed graph with N vertices and M edges that may contain cycles, the task is to find the lexicographically smallest topological ordering of… Read More
Given a directed graph, check whether the graph contains a cycle or not. Your function should return true if the given graph contains at least… Read More
There are a total of n tasks you have to pick, labelled from 0 to n-1. Some tasks may have prerequisites, for example to pick… Read More
There are a total of n tasks you have to pick, labeled from 0 to n-1. Some tasks may have prerequisites tasks, for example to… Read More