Understanding the approximate nearest neighbor (ANN) algorithm