Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

New answers tagged


I can see several problems with your solution. First of all, I don't think you are updating the balls after every second, as I would expect there to be a loop from $1$ to $t_i$. I think you are adding $t_1$ seconds, then adding $t_2$ seconds etc. Which brings up the second problem. I think you are treating the intervals $t_i$ as incremental, whereas in the ...


When measuring comparisons, we usually only charge comparisons of elements of the array (more accurately, we charge comparisons for the datatype of array elements, but not of array indices). In the example of linear search, at each iteration you are comparing one element of the array to the input element being searched. So in total, you are making exactly $n$...

Top 50 recent answers are included