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

android - net_scheduler holding wakelock -

sql - MySQL : Getting Entries from a many-to-many table -

java - Retrieving data from database using jsp (Hibernate + Spring + Maven) -