| ▲ | tristanj 2 hours ago | ||||||||||||||||
You can also solve this in O(logn) using a physical binary search: 1) Move half the boxes to another room. 2) Listen for a beep and determine which room the beep comes from. 3) Take the boxes in that room and split them in half again. 4) Repeat until one box is left. | |||||||||||||||||
| ▲ | aizk an hour ago | parent | next [-] | ||||||||||||||||
It's O(logn) but you haven't accounted for how heavy each item in the array of n is. | |||||||||||||||||
| |||||||||||||||||
| ▲ | entropie an hour ago | parent | prev | next [-] | ||||||||||||||||
Or you could use a very heavy blanked to just cover some boxes to supress the sound enough to simulate moving boxes. | |||||||||||||||||
| ▲ | peri-cl 18 minutes ago | parent | prev | next [-] | ||||||||||||||||
Yes, but that's also O(log n) physical effort. This one's O(1) sitting on your butt. (Out of curiosity: I think "physical binary search" is more properly O(n^{1/3} log(n)), or maybe O(n^{1/2} log(n)). Since physical objects have sizes, and moving things (or moving between things) takes time proportional to distance). | |||||||||||||||||
| ▲ | pyrolistical 10 minutes ago | parent | prev | next [-] | ||||||||||||||||
That requires you to stand in the room and listen for which side. So it’s nlogn times a very long time constant | |||||||||||||||||
| ▲ | ARandomerDude 2 hours ago | parent | prev [-] | ||||||||||||||||
> Move half the boxes to another room. Alternatively, no. | |||||||||||||||||
| |||||||||||||||||