This topic contains 0 replies, has 0 voices, and was last updated by  EduGorilla 1 year, 11 months ago.

• Author
Posts
EduGorilla
Keymaster
Select Question Language :

Suppose that you are given ‘n’ red and ‘n’ blue water jugs, all of different shapes and sizes. All red jugs hold different amounts of water, as do the blue ones. Moreover, for every red jug, there is a blue jug that holds the same amount of water, and vice versa Your task is to find a grouping of the jugs into pairs of red and blue jugs that hold the same amount of water. Assume that a comparison takes one time unit. Your goal is to find an algorithm that makes a minimum number of comparisons to determine the grouping. Remember that you may not directly compare two red jugs or two blue jugs.
What will be the number of comparisons of the best algorithm ?

Options :-

1. O(n2)
2. O(n3)
3. O(nlogn)
4. O(n2logn)
Are You looking institutes / coaching center for
• IIT-JEE, NEET, CAT
• Bank PO, SSC, Railways
Select your Training / Study category
Reply To: Suppose that you are given ‘n’ red and ‘n’ blue water jugs, all of different shapes and sizes. All r….

Verify Yourself