algorithm - 关于 8 拼图的 Hamming 和 Manhattan 优先级计算

标签 algorithm computation hamming-distance

http://coursera.cs.princeton.edu/algs4/assignments/8puzzle.html

根据上述链接计算出的海明和曼哈顿优先级是否正确?

For example, the Hamming and Manhattan priorities of the initial search node below are 5 and 10, respectively.

Note that we do not count the blank square when computing the Hamming or Manhattan priorities.

最佳答案

因此,其中 3 个在正确的位置,5 个不在正确的位置。这给出了 5 作为汉明距离,并且需要一些小的操作才能看到曼哈顿优先级是 10。

enter image description here

关于algorithm - 关于 8 拼图的 Hamming 和 Manhattan 优先级计算,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48199527/

相关文章:

c++ - 代码中需要澄清,底层数学是什么?

algorithm - 具有恒定内存量的 BFS

node.js - 如何执行密集的 Node.js 计算

python - 为什么 cv2.NORM_HAMMING 给出的值与实际汉明距离不同?

java - 在 Java 中通过给定的最大汉明距离(不匹配数)获取所有字符串组合

algorithm - Pagerank 与 SVD

algorithm - 为 Tic Tac Toe 的极小极大算法找出可能的走法

matlab - 为什么 MATLAB 中的 fix((20.45-20)*60) 与 fix((20)*60) 不相等

theory - 理论计算机科学什么时候有用?

postgresql - PostgreSQL 中的 bit_count 函数