![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
排序
accosmos
这个作者很懒,什么都没留下…
展开
-
排序方法
归并排序: 原理是分治法,分成两份。 void merge_sort(int *A, int x, int y, int *T) { if (y - x > 1) { int m = x + (y - x) / 2; int p = x, q = m, i = x; merge_sort(A, x, m, T); merge_sort(A, m, y, T); ...原创 2019-01-25 21:27:17 · 129 阅读 · 0 评论 -
uva 10305拓扑排序
题意:给定n个二元组(u,v)表示u<v。将这些元素排序。 分析:dfs搜索,如果存在有向环,那么无解。 #include<cstdio> #include<cstring> const int maxn = 1000; int n, m, G[maxn][maxn], c[maxn], topo[maxn], t; bool dfs(int u){ c[u...原创 2019-03-16 15:47:24 · 117 阅读 · 0 评论