Nuts and Bolts It Is
Well, recently I stumbled upon Nuts and Bolts problem. Also, I learnt Java very recently and wanted to try out some features of it.
Problem statement: #
The nuts and bolts problem is defined as follows. You are given a collection of n bolts of different sizes, and n corresponding nuts. You can test whether a given nut and bolt fit together, from which you learn whether the nut is too large, too small, or an exact match for the bolt. The differences in size between pairs of nuts or bolts are too small to see by eye, so you cannot compare the sizes of two nuts or two bolts directly. You are to match each bolt to each nut. Assume that for every nut you have a matching bolt.
This problem is different from other problems because it has a constraint which says you cannot compare nut with a nut or bolt with a bolt. Had it been that, we can compare a nut with a nut or bolt with a bolt, we...
Continue reading →