由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 谁能猜猜,这是个什么 algorithm?
相关主题
问一道最近的onsite题菜鸟的问题:Given a string, find whether it has any permutation of another string
谁能贴一下求nth permutation 和已知permutation 求rank的codeC的店面
请教一道题目这道题咋做?
今天才整明白Permutation的最优解!?Dream company Onsite被搞了(少量面经)
谁能帮我写写这道题? print all permutations of a string星期一福利:某公司店面题
an interview questionG面经
查找substr的问题Google onsite 题目求助
问个外循环和内问题返回字符串所有的 combination
相关话题的讨论汇总
话题: string话题: chars话题: newstring话题: st
进入JobHunting版参与讨论
1 (共1页)
r******r
发帖数: 700
1
Complexity 是多少? 别运行,试试看。
public static void mysteriousAlgorithm(String st, String chars) {
if (chars.length() == 1)
System.out.println(st + "" + chars);
else
for (int i = 0; i < chars.length(); i++) {
String newString = chars.substring(0, i) + chars.
substring(i + 1);
mysteriousAlgorithm(st + chars.charAt(i), newString);

}
}
p*****r
发帖数: 56
2
simple permutation? O(n!)



【在 r******r 的大作中提到】
: Complexity 是多少? 别运行,试试看。
: public static void mysteriousAlgorithm(String st, String chars) {
: if (chars.length() == 1)
: System.out.println(st + "" + chars);
: else
: for (int i = 0; i < chars.length(); i++) {
: String newString = chars.substring(0, i) + chars.
: substring(i + 1);
: mysteriousAlgorithm(st + chars.charAt(i), newString);
:

r******r
发帖数: 700
3
你很熟悉啊。像这种 complexity, 该怎么分析呢?
从程序不容易看出来吧。难道从数学的角度?

【在 p*****r 的大作中提到】
: simple permutation? O(n!)
:
:

p*****r
发帖数: 56
4
EN. 就是從數學角度.
專做 complexity的那些人多數連程序都不寫. 就是個數學家

~

【在 r******r 的大作中提到】
: 你很熟悉啊。像这种 complexity, 该怎么分析呢?
: 从程序不容易看出来吧。难道从数学的角度?

1 (共1页)
进入JobHunting版参与讨论
相关主题
返回字符串所有的 combination谁能帮我写写这道题? print all permutations of a string
报一个F 家面经an interview question
请教一个leetcode time complexity,Palindrome Partitioning查找substr的问题
问道题string pattern match的题目问个外循环和内问题
问一道最近的onsite题菜鸟的问题:Given a string, find whether it has any permutation of another string
谁能贴一下求nth permutation 和已知permutation 求rank的codeC的店面
请教一道题目这道题咋做?
今天才整明白Permutation的最优解!?Dream company Onsite被搞了(少量面经)
相关话题的讨论汇总
话题: string话题: chars话题: newstring话题: st