How to find closest point(s) around a specific point in point cloud?



I can't find any site with information about the simplest way to
locate the n number of closest points adjacent to a point in a 3d
point cloud with scattered data.

Basically, I've got an array, call it V, with a couple of hundred
positions [x,y,z] and a value (eg [0-100).

Let's say I wanted to pick the 5 closest points around a specific
point, call it P, with a value like [x,y,z] = [10,20,30]

I'm going to have to write functions in different languages, so some
generic pseudo code would be great.

Robert Karlsson
.