title: Time complexity of a program which involves multiple variables
body: <p>I was recently asked to create a program to find best matches  in text fragment. I have successfully written this program but I do have a question about its time complexity.</p>
  <p>Problem is defined as following.</p>
  <p>given a query, find occurrences of the query words in document and highlight the best tokens.</p>
  <p>The time that my program takes</p>
  <blockquote>
  <p>O(m + n + p)</p>
  </blockquote>
  <p>here</p>
  <blockquote>
  <p>m = length of the document in characters</p>
  <p>n = length of the query in characters</p>
  <p>p = number of total matches in the document</p>
  </blockquote>
  <p>In this case the biggest term is always going to be &quot;m&quot; because in most cases documents are going to be larger then the query itself.</p>
  <p>Can I safely deduce that time complexity of my program is O(m)?</p>