function [neighbor_index] = find_nn(data, test, k_values)
% data=data';
% test=test';

num_train = size(data,1);
num_test  = size(test,1);


%% BEGIN kNN


for i=1:num_test
    distances = (repmat(test(i,:), num_train,1) - data).^2;
    % for efficiency, no need to take sqrt since it is a non-decreasing function
    distances = sum(distances,2)';

    % sort the distances
    [junk, indeces] = sort(distances);

    for k=1:length(k_values)
	neighbor_index{i,k} = indeces(2:k_values+1);
	
	
    end
end