title: Is time Complexity O(nm) equal to O(n^2) if m <= n
body: <p>I am studying the time complexity of an algorithm to find if a string <strong>n</strong> contains a substring <strong>m</strong> where <strong><em>m &lt;= n</em></strong>. The result of the analysis is that the time complexity is <em>O(nm)</em>. So taking this time complexity as starting point and knowing that <em>m &lt;= n</em>, thus <em>mn &lt;= n^2</em>. Can we say that time complexity in big-O notation is <em>O(n^2)</em>.</p>