Difference between revisions of "TADM2E 5.23"

From Algorithm Wiki
Jump to: navigation, search
(Recovering wiki)
(No difference)

Latest revision as of 18:24, 11 September 2014

  1. Create a directed graph with the vertices representing the children and the edges representing the "i hates j" relations and use topological sorting. This will either give out a list representing the order in the line or tell you if it's not possible, i.e. a cycle is in the graph.
  2. Build a BFS graph from the directecd graph as built in the previous task. The maximum depth of this graph is the number of rows necessary.