由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 有重复元素的全排列,递归算法
相关主题
生成一个有重复数的全排列,怎么做比较好经典递归题需要搞懂非递归算法吗?
关于排列组合的题目的算法关于Inplace排序栈元素的解法?
问一个题Quick sort为什么需要logN的memory?
用了递归以后,怎么计算空间复杂度?面试时 迭代还是递归
求推荐学习recursive 算法的资料找2个sorted array中的第K小的元素,有O(lgn)方法吗?
关于排列组合的总结binary search in rotated sorted array有重复时怎么办?
对自己DFS能力彻底的绝望了。像准备高考,准备 GRE 一样地准备算法
被这几个题目搞混了请教一个算法题
相关话题的讨论汇总
话题: bullmj话题: list话题: 递归话题: 重复
进入JobHunting版参与讨论
1 (共1页)
S**Y
发帖数: 136
1
有重复元素的排列,递归算法应该怎么做呢?
比如( 1 2 3 3)
则输出: 1233 1323 1332 2133 2313 2331 ,etc.
z***e
发帖数: 5393
2
permutation is based on index, not the value itself.

【在 S**Y 的大作中提到】
: 有重复元素的排列,递归算法应该怎么做呢?
: 比如( 1 2 3 3)
: 则输出: 1233 1323 1332 2133 2313 2331 ,etc.

g*******y
发帖数: 1930
3
three ways:
1. implement and call next_permutation();
2. modify the original permutation algorithm by using strchr(), for details search bullmj's post before.
3. recursion + list (linked list); maintain the list that you operate on is always sorted (faster than array because you can do O(1) insert/delete)

【在 S**Y 的大作中提到】
: 有重复元素的排列,递归算法应该怎么做呢?
: 比如( 1 2 3 3)
: 则输出: 1233 1323 1332 2133 2313 2331 ,etc.

n*******s
发帖数: 482
4
2. recursion + list (linked list);
是说 按正常permutation生成,存储结果,检测重复项么?
s*****r
发帖数: 773
5
你没理解题目

【在 z***e 的大作中提到】
: permutation is based on index, not the value itself.
s*****d
发帖数: 43
6
小羊,
可否给个LINK?找不到bullmj的post.谢过先。

details search bullmj's post before.
is always sorted (faster than array because you can do O(1) insert/delete)

【在 g*******y 的大作中提到】
: three ways:
: 1. implement and call next_permutation();
: 2. modify the original permutation algorithm by using strchr(), for details search bullmj's post before.
: 3. recursion + list (linked list); maintain the list that you operate on is always sorted (faster than array because you can do O(1) insert/delete)

1 (共1页)
进入JobHunting版参与讨论
相关主题
请教一个算法题求推荐学习recursive 算法的资料
ebay 电面关于排列组合的总结
Non-recursive permutation对自己DFS能力彻底的绝望了。
linked list排序的算法除了bubble被这几个题目搞混了
生成一个有重复数的全排列,怎么做比较好经典递归题需要搞懂非递归算法吗?
关于排列组合的题目的算法关于Inplace排序栈元素的解法?
问一个题Quick sort为什么需要logN的memory?
用了递归以后,怎么计算空间复杂度?面试时 迭代还是递归
相关话题的讨论汇总
话题: bullmj话题: list话题: 递归话题: 重复