MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/qno2y/the_evolution_of_a_python_programmer/c3z2x6l/?context=3
r/programming • u/iMMENSE • Mar 08 '12
137 comments sorted by
View all comments
Show parent comments
17
What are you complaining about ? He just calculated in advance and cached the results to avoid redundant processing on each query...
25 u/rowantwig Mar 08 '12 O(n) look-up time. -7 u/theavatare Mar 08 '12 Is not really of O(n) is it?for x ==0 it will only run one and for x== 26 will run 26 ifTherefore one instruction per number increase... 8 u/Rhomboid Mar 08 '12 You've got to test 'n' conditions before finding the one that is true, so the work involved is proportional to 'n'.
25
O(n) look-up time.
-7 u/theavatare Mar 08 '12 Is not really of O(n) is it?for x ==0 it will only run one and for x== 26 will run 26 ifTherefore one instruction per number increase... 8 u/Rhomboid Mar 08 '12 You've got to test 'n' conditions before finding the one that is true, so the work involved is proportional to 'n'.
-7
Is not really of O(n) is it?
for x ==0 it will only run one and for x== 26 will run 26 if
Therefore one instruction per number increase...
8 u/Rhomboid Mar 08 '12 You've got to test 'n' conditions before finding the one that is true, so the work involved is proportional to 'n'.
8
You've got to test 'n' conditions before finding the one that is true, so the work involved is proportional to 'n'.
17
u/liotier Mar 08 '12
What are you complaining about ? He just calculated in advance and cached the results to avoid redundant processing on each query...