  Anomaly detection plays a critical role in fraud detection, health care,
intrusion detection, military surveillance, etc. Anomaly detection algorithm
based on density estimation (called ADDE algorithm) is one of widely used
algorithms. Liang et al. proposed a quantum version of the ADDE algorithm
[Phys. Rev. A 99, 052310 (2019)] and it is believed that the algorithm has
exponential speedups on both the number and the dimension of training data
point over the classical algorithm. In this paper, we find that Liang et al.'s
algorithm doesn't actually execute. Then we propose a new quantum ADDE
algorithm based on amplitude estimation. It is shown that our algorithm can
achieves exponential speedup on the number $M$ of training data points compared
with the classical counterpart. Besides, the idea of our algorithm can be
applied to optimize the anomaly detection algorithm based on kernel principal
component analysis (called ADKPCA algorithm). Different from the quantum ADKPCA
proposed by Liu et al. [Phys. Rev. A 97, 042315 (2018)], compared with the
classical counterpart, which offer exponential speedup on the dimension $d$ of
data points, our algorithm achieves exponential speedup on $M$.
