title: Determining running time of an algorithm to compare two arrays
body: <p>I want to know how it is possible to determine the run time of an algorithm written in pseudocode so that I can familiarize myself with run time. So for example, how do you know what the run time of an algorithm that will compare 2 arrays to determine if they are not the same?</p>
  
  <p>Array 1 = [1, 5, 3, 2, 10, 12]    Array 2 = [3, 2, 1, 5, 10, 12]
  So these two arrays are not the same since they are ordered differently.</p>
  
  <p>My pseudocode is:</p>
  
  <p>1) set current pointer to first number in first array<br>
  2) set second pointer to first number in second array<br>
  3) while ( current pointer != " ") compare with same position element in other array<br>
  4) if (current pointer == second pointer)<br>
      move current pointer to next number
          move second pointer to next number</p>
  
  <p>5) else (output that arrays are not the same)
  end loop</p>
  
  <p>So I am assuming first off my code is correct. I know step 4 executes only once since it only takes 1 match to display arrays are not the same. So step 4 takes only constant time (1). I know step 1 and 2 only execute once also.</p>
  
  <p>so far I know run time is 3 + ? (? being the run time of loop itself)</p>
  
  <p>Now I am lost on the loop part. Does the loop run n times (n being number of numbers in the array?), since worst case might be every single number gets matched? Am I thinking of run time in the right way?</p>
  
  <p>If someone can help with this, I'll appreciate it.</p>
  
  <p>Thanks!</p>