![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
拓扑排序
尉水风
这个作者很懒,什么都没留下…
展开
-
Ordering Tasks
拓扑排序 ohn has n tasks to do. Unfortunately, the tasks are not independent and the execution of one task is only possible if other tasks have already been executed. Input The input will consist of s原创 2017-07-25 16:55:36 · 225 阅读 · 0 评论 -
蓝桥-ADV-169 士兵排队问题
算法提高 士兵排队问题 试题 有N个士兵(1≤N≤26),编号依次为A,B,C,…,队列训练时,指挥官要把一些士兵从高到矮一次排成一行,但现在指挥官不能直接获得每个人的身高信息,只能获得“P1比P2高”这样的比较结果(P1、P2∈A,B,C,…,Z,记为 P1>P2),如”A>B”表示A比B高。 请编一程序,根据所得到的比较结果求出一种符合条件的排队方案。 (注:比较结果...原创 2018-03-10 12:28:35 · 346 阅读 · 0 评论 -
拓扑排序
vector<int> G[maxv]; //邻接表 int n,inDegree[maxv];//顶点数,入度 bool toplogicalSort() { int num=0; //记录顶点数 queue<int> q; for(int i=0;i<n;i++) { if(inDegree[i]==0) { q.push(i)...原创 2018-05-24 18:56:42 · 182 阅读 · 0 评论