AQ4.4 Q3

834 views
Skip to first unread message

CSE IT GATE ACADEMY

unread,
Nov 19, 2020, 3:54:43 AM11/19/20
to Discussion forum for Computational Thinking
We distribute the 20 objects into bins of equal size. How many bins should we choose to make the least number of comparisons overall? 
Please Explain this question 

Prateek Thakur

unread,
Nov 19, 2020, 4:20:12 AM11/19/20
to Discussion forum for Computational Thinking, CSE IT GATE ACADEMY

We will make 10 bin, so that all bins have 2 elements each and both element can be compared in single go.
This is because if we have compared 1 element with another in same bin we don't need to now comapre 2 nd element with first one.
And if we go for 20 bin than we are not able to compare any element because there is no other element which will be used to compare in same bin.
SO equal distribution with least comaprision can be done in case of 10 bin where each bin has two element and in each bin we need to perform single comparison.
Hope I have helped with your query.
Reply all
Reply to author
Forward
0 new messages