digit recognition using k-nearest neighbor algorithm