We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7b548e5 commit 76db6c3Copy full SHA for 76db6c3
_posts/2015-1-11-topsort.md
@@ -8,9 +8,11 @@ tags: [algorithm, maizi]
8
9
提供一个topsort coffeescript的实现,由于课程时间所限topsort没有放在课里讲,对有向图节点排序有兴趣的同学可以自学一下。
10
11
+下面的代码是使用DFS的topsort算法,具体算法描述可以看[Topological sort wikipedia](http://en.wikipedia.org/wiki/Topological_sorting)
12
13
14
{% highlight coffeescript %}
15
+ class Graph
16
# topological sort
17
top_sort:()->
18
result = [] #sort result
@@ -42,3 +44,4 @@ tags: [algorithm, maizi]
42
44
return result
43
45
46
{% endhighlight %}
47
+
0 commit comments