use histogram for diff.algorithm