Log In
0 votes

You are given a set of n nuts and another set of n bolts such that they form n distinct pairs of matching nuts and bolts, i.e., each of the bolts go into one nut only. What will the number of comparisons to matching operation conducted in an effective manner? (Note: The only allowed operation is trying to fit a bolt into a nut and thereby concluding whether they are of equal size, or find out which is greater in size)

in Algorithms 134 views
O(nlogn) ??
yes plz explain approach
simply apply  sorting algorithm on both nuts and bolts nd we have O(nlogn) best sorting algorithm time.

Please log in or register to answer this question.

No related questions found