Suppose I have two algorithms A()
and B()
such that algorithm A()
takes exactly O(3n^2)
while algorithm B()
takes O(n^2)
. Although both algorithms run in quadratic time, can we say algorithm B runs faster than?
I understand that we ignore constants when analyzing the running time of an algorithm but I want to ask about the case when we need to consider the constants while analyzing algorithms.
Thank you