function nearest1 ( )

%% NEAREST1 seeks the nearest neighbor to 100 random cities.

  n = 100;
  cities = rand ( 2, n );
  me = rand ( 2, 1 );

  nearest = 0;
  dist = Inf;
  for j = 1 : n
    d = norm ( me - cities(1:2,j) );
    fprintf ( 1, '  %d  %f  %f  %f\n', j, cities(1,j), cities(2,j), d );
    if ( d < dist )
      nearest = j;
      dist = d;
    end
  end

  fprintf ( 1, '\n' );
  fprintf ( 1, 'Nearest city is %d\n', nearest );
  fprintf ( 1, 'Distance is %g\n', dist );

  clf
  hold on
  plot ( cities(1,1:n), cities(2,1:n), 'k.', 'Markersize', 25 );
  plot ( me(1), me(2), 'r.', 'Markersize', 25 );
  axis equal
  grid
  hold off

  return
end
