Why 100 lines of Code can be better than 2 lines of code...
Yes, It is true!!! that 100 lines of code can be better than 2 lines of code. Let’s say you are given 9 balls. Out of 9 balls, 8 balls have same weight (say 1 kg) and only one ball is heavy (say 2 kg). Now, you have to find the position of the heavie...
codegyan.hashnode.dev2 min read
GirdhaR
one day or day one
in the worst case it would be 4 comparisons. in your example if the heaviest ball is either among ball 1,2,4 or 5 then it would take 4 comparisons to find that ball