There are 3 baskets of fruits with worng lables,one basket
has apple,another basket has orange,another has combination
of apple and orange,what is the least way of interchange
the lables.

Answer Posted / anoop

Beside answer 3, following is one more alternative:

Let the 3 baskets with labels A,O,M.
Interchange labels of any 2 baskets. (assume that u
interchanged lables of A & O)

Now see (or take out) the fruits of either of the baskets
with changed labels (A & O).

There wud be 2 cases:
1. This basket(the one of which u saw (or took out) the
fruits) has fruits not conforming to the label.
2. This basket(the one of which u saw (or took out) the
fruits) has fruits conforming to the label.

If (1) is true,just interchange its label with the third
untouched basket (basket with label M).

If (2) is true, just interchange label of other basket with
the third untouched basket (basket with label M).

Idea is : Just one interchange of labels of any 2 basket
will fix one basket with correct label. In second step you

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the purpose of main( ) in c language?

614


what are non standard function in c

1429


What's the difference between constant char *p and char * constant p?

651


What is the function of this pointer?

666


Write a function expand(s1,s2) that expands shorthand notations like a-z in the string s1 into the equivalent complete list abc...xyz in s2 . Allow for letters of either case and digits, and be prepared to handle cases like a-b-c and a-z0-9 and -a-z. z-a:zyx......ba -1-6-:-123456- 1-9-1:123456789987654321 a-R-L:a-R...L a-b-c:abbc

5053






What is a string?

661


Why does notstrcat(string, "!");Work?

637


What is sizeof array?

604


Explain what is operator promotion?

629


Which is not valid in C a) class aClass{public:int x;}; b) /* A comment */ c) char x=12;

603


What is the benefit of using #define to declare a constant?

601


How can I do serial ("comm") port I/O?

681


Explain pointer. What are function pointers in C?

622


What do you mean by dynamic memory allocation in c? What functions are used?

650


How are pointers declared in c?

592