topologicaal sort of Orders with dependencies using depth first search