开发者

Similar to traveling salesman problem? Flooding console with output?

DISCLAIMER This is for a crypto program for one of my classes and possibly personal use. However I am not being graded on it.

I already cracked this code, and it is a random caeser cypher. Q PC JI UQTGF TQBMU SIX. XMGS开发者_如何学编程 QJ UMQJ IKGT?

Now to solve this computationally using dictionaries wouldn't it be similar to the traveling salesman problem? O(n!) for a worst case scenario. Also, since the computer has no way of knowing if something is correct wouldn't I have to spit every ending permutation out for review? Or should I put some sort of lower bounds for human review? Like at least a 40% match?


Caesar Ciphers are simply taking letters and replacing them with letters shifted s position down.

So: For each letter in the alphabet, a,

You iterate a times.

Then for each of the v words in the cipher, you must go through d words in the dictionary.

A cycle through the words, ignoring compressions and whatnot, would yield a complexity of O(a*v*d), and if a==26, O(v*d). However, the complexity is essentially based on HOW YOUR DICTIONARY ALGORITHM WORKS- O( is_sentence_valid) == O(cipher_solver)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜