point having minimum distance from the point p
int ind = 0 ; int n = a . size ( ) ; for ( int i = 1 ; i < n ; i ++ ) { if ( sqDist ( p , a . get ( i ) ) < sqDist ( p , a . get ( ind ) ) ) { ind = i ; } }