Home > Back-end >  Time complexity O (m, n) and O (Max (m, n)) can be thought of as equivalent?
Time complexity O (m, n) and O (Max (m, n)) can be thought of as equivalent?

Time:11-03

As title, time complexity O (m + n) and O (Max (m, n)) can be thought of as equivalent?

CodePudding user response:

One is m + n, one is m or n, of course

CodePudding user response:

A m + n, one is the Max (m, n), m, n the larger value,

For example, m=8, n=6; So a complexity is 14, the second complexity is 8, obviously

CodePudding user response:

Want to see the relationship between the m and n, if is linear or m is constant, can be thought of as equivalent, O (a * n + b), if a, b is constant, the complexity is O (n) and so O (n) algorithm is not necessarily better than O (n ^ 2) algorithm, to look at the size of n

CodePudding user response:

In fact the two are the complexity of the O (n) level,

CodePudding user response:

At least king says, the book

CodePudding user response:

O (N) represents the time complexity is linear growth, which is the input data size and time consuming is a linear relationship between
O (Max (m, n)) and O (m + n) actually like
  • Related