1. minIndex = 0
  2. min = a[minIndex]
  3. for i = 1 to n-1
  4. if a[i] < min
  5. minIndex = i
  6. min = a[minIndex]