c++ - What is more expensive? Reading or comparing integers, doubles -
i asked myself, big o notation c++ min has.
i want minima set of integers.
i saw in stackoverflow similar question.
the answer o(n), because have read n numbers.
but correct, if reading critical operation.
my question is: more expensive? (in cpu clocks or whatever) reading or comparing?
it depends on platform, surely reading values memory more expensive operations on cpu. but, on topic of big o notation - it's not operation more expensive. it's fact algorithm scales number of inputs (i.e. n).
Comments
Post a Comment