Taken from here Marcelo Cantos has replied:
O((n/2 + 1)*(n/2)) = O(n2/4 + n/2) = O(n2/4) = O(n2)
Up to
O(n2/4) = O(n2)
I can understand, but why is the dividing by 4 ignored (or the multiplying by 1/4)?
Taken from here Marcelo Cantos has replied:
O((n/2 + 1)*(n/2)) = O(n2/4 + n/2) = O(n2/4) = O(n2)
Up to
O(n2/4) = O(n2)
I can understand, but why is the dividing by 4 ignored (or the multiplying by 1/4)?
Constant multipliers are ignored when dealing with complexity. Whether a step in an algorithm is 2, 4, or 1000 times as long as a step in another algorithm is irrelevant when all we care about is the number of steps involved.