title: Expected number of assignments to find maximum value in an array
body: <p>In the following Java code:</p>
  
  <pre><code>int max = arr[0];
  for (int i = 0; i &lt; arr.length i++) {
      if (arr[i] &gt; max) {
           max = arr[i];
      }
  } 
  </code></pre>
  
  <p>How many times does the line <code>max = arr[i];</code> run assuming that the array is unsorted.</p>