摘要: 有一种排序叫做计数排序(它是与桶排序不同的),虽然它们的时间复杂度都是O(n),但是计数排序比桶排序更稳定.... 下面就根据代码看一下计数排序的模板以及其原理: 1 #include<cstdio> 2 #include<algorithm> 3 using namespace std; 4 in 阅读全文
posted @ 2019-02-01 12:21 dfydn 阅读(343) 评论(0) 推荐(0)
摘要: next_permutation prev_permutation 1 #include<cstdio> 2 #include<iostream> 3 #include<algorithm> 4 5 using namespace std; 6 7 int n,z[1234]; 8 9 int ma 阅读全文
posted @ 2019-02-01 12:10 dfydn 阅读(232) 评论(0) 推荐(0)
摘要: 嗯.... unique这个东西也是一个冷门知识..... 但是在有时候它还是比较好用的东西... 下面就在详细代码中看unique是如何实际应用的....它主要是用于数组去重 1 #include<cstdio> 2 #include<algorithm> 3 4 using namespace 阅读全文
posted @ 2019-02-01 08:00 dfydn 阅读(600) 评论(0) 推荐(0)
摘要: 链表是一个线性数据结构 1 #include<cstdio> 2 3 using namespace std; 4 5 struct lian_biao_jie_dian//结构体自己造链表 6 { 7 int next,pre;//next 为下一节点,pre 为上一节点 8 int value; 阅读全文
posted @ 2019-02-01 00:46 dfydn 阅读(998) 评论(0) 推荐(0)
摘要: 读入/输出优化的原理是利用了getchar() / putchar()这两个函数的速度较快,然后对应每一位处理。 1 #include<iostream> 2 #include<cstdio> 3 4 using namespace std; 5 6 int readint() 7 { 8 char 阅读全文
posted @ 2019-02-01 00:34 dfydn 阅读(265) 评论(0) 推荐(1)