Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
这些函数的复杂性是线性的,例如 O(n)。我认为前两个是线性的
是的,所有都是线性的,任何常数都可以忽略,常数系数 2n 对于 3 是 O(n)。它是 1/2n+1/2n 可以忽略,所以它应该都是 O(n)