Reminds me of the Spaghetti Sorting algorithm. https://en.wikipedia.org/wiki/Spaghetti_sort
Reminds me of the Spaghetti Sorting algorithm. https://en.wikipedia.org/wiki/Spaghetti_sort
>> contact-and-removal operation takes constant time, the worst-case time complexity of the algorithm is O(n).
How is the contact-and-removal operation constant time? How can that assumption ever be true? If you use a parallel processor like human vision or human feel (ie. which pressure nerve activates on the hand) it may appear constant, but if you use a computer it would be n right (as you would need to check n slots). Wouldn't either defy O(n)?
The point is that reality itself is highly parallel
1. how fast your hand can reach for the next spaghetti piece - on average proportional to the radius of the pile of spaghetti, which is proportional to sqrt(n).
2. to actually notice the biggest piece, you need to again wait for a time proportional to sqrt(n) - light propagation is not instant.
So if we start thinking about this algorithm more like a computer scientist would (how fast it is as n grows to the infinity) it doesn't seem to be O(n) IMO.