Comment on What real life bad habits has programming given you?Comments−paulgb17yI've caught myself thinking of time in complexity classes.Eg. should I walk or drive? It doesn't matter, they're both O(n).−oconnor017yWhen I'm driving, I'll make the decision on passing someone or not depending on whether the resultant speedup is O(1) or O(n).−Hexstream17yWalking would be O(n^2) for all but the shortest distances actually, I think. Unless you rested once in a while. Amortized linear time?−BeefingJection17yHow do you figure?−Hexstream17yDoes walking continuously for 1000km merely take 100 times longer/more effort than 10km?−paulgb17yGood point, but you answered your own question: the "walk then rest" algorithm will do it in linear time.−tjpick17ynull pointer on your drink-bottle instance results in fatal runtime exception.−paulgb17yPun intended?−tjpick17yda-da-chhhhh. you're quick ;)
Comments
I've caught myself thinking of time in complexity classes.
Eg. should I walk or drive? It doesn't matter, they're both O(n).
When I'm driving, I'll make the decision on passing someone or not depending on whether the resultant speedup is O(1) or O(n).
Walking would be O(n^2) for all but the shortest distances actually, I think. Unless you rested once in a while. Amortized linear time?
How do you figure?
Does walking continuously for 1000km merely take 100 times longer/more effort than 10km?
Good point, but you answered your own question: the "walk then rest" algorithm will do it in linear time.
null pointer on your drink-bottle instance results in fatal runtime exception.
Pun intended?
da-da-chhhhh. you're quick ;)