Topological Sort

  • Minimum Height Trees
    You are given a tree represented as an undirected graph, where each node has a unique value between 0 and n-1. The tree is given as a list of edges. You need to find and return all the “root” nodes of the minimum height trees (MHTs).
  • Alien Dictionary
    Given a list of words sorted in a special alien language, find the order of characters in that language.The alien language is represented by a list of words where each word consists of lowercase letters. However, the order of the letters in the alien language is unknown.You need to determine the order of characters in the alien language based on the given list of words.
  • Course Schedule
    You are given a total number of courses (n) and a list of prerequisites represented as pairs of course numbers. The prerequisites indicate that to take course prerequisites[i][0], you must first complete course prerequisites[i][1]. It is guaranteed that a valid ordering of courses exists.