Given a set of N points, find the triplet with minimum sum of (3) distances. (Another way: find points forming a triangle with minimum perimeter.)
My solution uses this closest-pair algorithm (PDF), modified to suit. So, if you want to understand, that PDF is where you should really dig in.
My solution is in git and below: