
c++常用库函数实现
文章平均质量分 50
深入了解各种库函数的实现
return_dr
蒟蒻
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
实现next_permutation
讲暴力枚举或深搜时会讲到 《全排列问题》。其原理是深搜。 那么如何自己实现一个next_permutation呢·? 一、深搜 代码就不贴了,比较基础。 二、指针 我们可以用指针快速实现: #include <algorithm> #include <iostream> using namespace std; int a[10005]; template <class T> bool _next_permutation(T first, T last) {原创 2022-04-07 16:48:39 · 473 阅读 · 0 评论 -
关于c++中的各种排序
干货来了———— 排序算法主要包括:计数排序(桶排序)、插入排序、选择排序、冒泡排序、快速排序等。那这些排序的效率如何呢? 文章目录主程序生成数据程序输入数据输出文件 主程序 #include <ctime> #include <cstdio> #include <iostream> #include <memory.h> #define endl '\n' using namespace std; int n, maxn; int a[20005], b[原创 2022-04-06 17:51:20 · 1062 阅读 · 0 评论