The Gateway to Computer Science Excellence
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 by Loyal (5.7k points) | 54 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.

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,309 answers
105,024 users