There are twelve wires that run from your cellar to your roof. Unfortunately on their journey they could be randomly mixed up, so you can't tell which cellar wire-end corresponds to which roof wire-end. You have a battery and a light bulb, and you can temporarily twist wires together. You can also travel from the cellar to the roof and back again any number of times. Thus you can construct circuits and test the wires at either end in order to deduce what is going on. But itís a long way to the roof. So, starting at the bottom, what is the minimum number of journeys you have to make, in order to work out exactly which wire-end in the cellar corresponds with which wire-end on the roof?
My answer is 4 trips and goes as follows.........
connect 1 wire to negative terminal, 10 wires to positive and leave 1 disconnected.
go to roof
circuit test uniquely identifying negative terminal and disconnected wires. Label these 1 & 2 respectively. Connect number 1 wire to an unknown wire labeling it 3 and number 2 wire to another unknown labeling it 4.
go to cellar
circuit test uniquely identifying and labeling 3 and 4 wire. With remaining 8 unknown wires, connect 6 to positive and one to negative leaving one disconnected. Label these last two 5 and 6.
go to roof
circuit test uniquely identifying wires 5 and 6. Now we have identified and labeled 6 of the 12 wires we simply connect a known wire with an unknown wire.
go to cellar(trip 4)
circuit test uniquely identifying and labeling the last remaining 6 wires.
This is a solution, its my best but I dont know if it is the best.