In this paper a new algorithm to calculate optimum value of k for k-nearest neighborhood (k-NN) is proposed. Selection of k value is very important in k-NN classification algorithm. Our algorithm applied to sub-sampling and K-fold cross validation methods, separately. We applied our algorithm in different distribution of data set with different variances and means. We compared our algorithm with other classical k selection algorithms. The results show that the proposed algorithm achieved better performance than the classical algorithms.