added code for shortest path algorithm in DAG (linear time)