Thursday, July 27, 2006

Type safe enums : - Constant specific methods.

http://daily.delusions.de/archives/2005/01/05/java-enums/

http://java.sun.com/j2se/1.5.0/docs/guide/language/enums.html

Sunday, July 23, 2006

Topological Sort - A mechanism for sorting DAGs

Topological sort is used to sort Directed Acyclic Graphs (DAGs) is a linear ordering of sorting the
nodes such that each node comes before its children. Each DAG has atleast one topological sort
sort, but may have many.

This has many applications: (i) - (iii) from wikipedia
(a) makefile
(b) instruction scheduling
(c) formula-cell evaluation in spread sheets
(d) deep commit in DPL

To find the topological sort ordering - (i) Put all the nodes without any incoming edges into the queue; (ii) For each node in the queue trace the edges and add the nodes if it is entirely seperated from the DAG.