@Amol
I think the solution given above is fine except that i missed to initialize
A[src] =1. Thats the reason why u end up getting 0's for all A[i]'s.
Modification to the third step:
3) Scan the linearized list from left to right initialize all the
corresponding values in array A to 0.
Set A[sr
1) Linearize the DAG using DFS. ( topological sorting)
2) Now take an array of size A[N] ( N - nodes in the DAG ), where A[i]
mimics the 'i'th node in the linearized list.
3) Scan the linearized list from left to right to get to the source
node and initialize all the corresponding values in array A