Skip to content

Tag Archives: Topological Sorting

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
Given a Directed Acyclic Graph with n vertices and m edges. The task is to find the number of different paths that exist from a… Read More
Given an array of words, find any alphabetical order in the English alphabet such that the given words can be considered sorted (increasing), if there… Read More
A DAG is given to us, we need to find maximum number of edges that can be added to this DAG, after which new graph… Read More

Start Your Coding Journey Now!