title: Java - Selection Sort Algorithm
body: <p>I have some questions about selection sort.I'm a little bit confused.</p>
  
  <pre><code> int [] arr = {5,4,3,2,1}; // This is my array
      int min = 0;
  
      for(int i = 0;i&lt;arr.length;i++)
      {
          //Assume first element is min
          min = i;//Selection sort algorithm says that find the minimum in the
                  // array, but first element is not minimum.What's point here?
          for(int j = i + 1;j&lt;arr.length;j++)
          {
              int temp = arr[i];
              arr[i] = arr[j];
              arr[j] = temp;
              System.out.println(arr[i]);//I print the in ascending order 
          }
      }
  </code></pre>
  
  <p>Output is : </p>
  
  <pre><code>4
  3
  2
  1
  4
  3
  2
  4
  3
  4
  </code></pre>
  
  <p>What's wrong ? </p>