首页
it技术
登录
6mi
u
盘
搜
搜 索
it技术
STL中的permutation相关函数
STL中的permutation相关函数
it
2025-08-09
9
生成字符串全排列
// str需要先用sort进行升序排序一次
do
{
res
.
push_back
(
str
)
;
// 全排列集合
}
while
(
next_permutation
(
str
.
begin
(
)
,
str
.
end
(
)
)
)
;
//next_permutation()执行一次 当前的str序列abc 就变成了升序中的下一个str序列acb, 对应的还有prev_permutation
判断字典序是否一样
// 可以用于判断两个序列是否为排序关系
is_permutation
(
b1
,
e1
,
b2
,
e2
)
转载请注明原文地址: https://lol.8miu.com/read-28366.html
最新回复
(
0
)