Skip to content

Tag Archives: Topological Sorting

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, labeled 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
We are given a map of cities connected with each other via cable lines such that there is no cycle between any two cities. We… Read More
Given a Weighted Directed Acyclic Graph (DAG) and a source vertex in it, find the longest distances from source vertex to all other vertices in… Read More
Given a Directed Acyclic Graph (DAG), find Topological Sort of the graph.Topological sorting for Directed Acyclic Graph (DAG) is a linear ordering of vertices such… Read More
Topological sorting for Directed Acyclic Graph (DAG) is a linear ordering of vertices such that for every directed edge uv, vertex u comes before v… Read More