K-Nearest Neighbor is used broadly in text classification, but it has one deficiency—computational efficiency. In this paper, we propose a heuristic search way to find out the k nearest neighbors quickly. Simulated annealing algorithm and inverted array are used to help find out the expected neighbors. Our experimental results demonstrate a significant improvement in classification computational efficiency in comparison with the conventional KNN.