Tag Archives: Topological Sorting

Maximum edges that can be added to DAG so that is remains DAGNovember 10, 2016

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 »

Longest path between any pair of verticesOctober 17, 2016

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 »

Longest Path in a Directed Acyclic Graph | Set 2August 28, 2016

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 »

Topological Sort of a graph using departure time of vertexAugust 24, 2016

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… Read More »

Kahn’s algorithm for Topological SortingApril 5, 2016

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 »

All Topological Sorts of a Directed Acyclic GraphMarch 23, 2016

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 »

Top 10 Algorithms and Data Structures for Competitive ProgrammingDecember 16, 2015

In this post “Important top 10 algorithms and data structures for competitive coding “. Topics : Graph algorithms Dynamic programming Searching and Sorting: Number theory… Read More »

Top 10 algorithms in Interview QuestionsDecember 9, 2015

In this post “Top 10 coding problems of important  topics with their solutions ” are written. If you are preparing for a coding interview, going through… Read More »

Find Itinerary from a given list of ticketsMay 19, 2015

Given a list of tickets, find itinerary in order using the given list. Example: Input: “Chennai” -> “Banglore” “Bombay” -> “Delhi”

Assign directions to edges so that the directed graph remains acyclicApril 13, 2015

Given a graph with both directed and undirected edges. It is given that the directed edges don’t form cycle. How to assign directions to undirected… Read More »

Find the minimum cost to reach destination using a trainMarch 2, 2015

There are N stations on route of a train. The train goes from station 0 to N-1. The ticket cost for all pair of stations… Read More »

Given a sorted dictionary of an alien language, find order of charactersJuly 22, 2014

Given a sorted dictionary (array of words) of an alien language, find order of characters in the language.

Longest Path in a Directed Acyclic GraphSeptember 19, 2013

Given a Weighted Directed Acyclic Graph (DAG) and a source vertex s in it, find the longest distances from s to all other vertices in… Read More »

Shortest Path in Directed Acyclic GraphMay 13, 2013

Given a Weighted Directed Acyclic Graph and a source vertex in the graph, find the shortest paths from given source to all other vertices.

Topological SortingMay 12, 2013

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 »