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

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -