排序算法-洗牌算法
发布日期:2022-03-04 12:48:36 浏览次数:30 分类:技术文章

本文共 345 字,大约阅读时间需要 1 分钟。

黑马252

#include
#include
#include
#include
#include
#include
using namespace std;

void myprint(int v)

{
cout << v << " ";
}
void test01()
{
srand((unsigned int)time(NULL));
vectorv;
for (int i = 0; i < 10; i++)
{
v.push_back(i);
}
//利用洗牌算法 打乱顺序
random_shuffle(v.begin(), v.end());
for_each(v.begin(), v.end(), myprint);
}

int main()

{
test01();
}

转载地址:https://blog.csdn.net/qq_43752920/article/details/120552075 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:常用排序算法sort
下一篇:逻辑仿函数 逻辑非

发表评论

最新留言

表示我来过!
[***.240.166.169]2024年04月06日 15时52分09秒