algorithm - What is the efficiency of dividing N positive integers by a given power of 2? -
for example:
let's n = 128
. want divide each positive integer , including n
, say, 8
. perform integer division for:
1/8 2/8 3/8 ... 127/8 128/8
in looking up, see bit shift operations way go , compiler automatically way in first place. nonetheless, can't seem find big o function type of algorithm.
to sum up: given positive integer n
, , number y
power of 2
, efficiency of algorithm divides each of numbers 1,2,3,...,n
y
?
Comments
Post a Comment