The Electrician Problem

Source

I got this problem from Rustan Leino, who learned about it from Greg Nelson, who phrased it in terms of a tall building and elevator rides. Rustan switched it to a mountain and helicopter rides, which is the way Lyle Ramshaw had heard the problem and which more forcefully emphasizes the price of each ride.

I solved it and wrote up my solution.

Problem    

You're an electrician working at a mountain. There are $N$ wires, where $N > 2$, each of which runs from one side of the mountain to the other. The problem is that the wires are not labeled, so you just see $N$ wire ends on each side of the mountain. Your job is to match these ends. In other words, you need to label the two ends of each wire in the same way and use different labels for different wires.

To figure out the matching, you can twist together wire ends, thus electrically connecting the wires. You can twist as many wire ends as you want, into as many clusters as you want, at the side of the mountain where you happen to be at the time. You can also untwist the wire ends at the side of the mountain where you're at. You're equipped with an Ohm meter, which lets you test the connectivity of any pair of wires. However, it's only an abstract Ohm meter, in that it only tells you whether or not two things are connected, not the exact resistance.

You are not charged [no pun intended] for twisting, untwisting, labeling, and using the Ohm meter. You are only charged for each helicopter ride you make from one side of the mountain to the other. What's the best way to match the wires?

Hints    
Solution     Reveal