title: Selection Sort from both ends with Min and Max Python
body: <p>I need to implement a way to make a selection sort more efficient by working from both ends using min and max values.</p>
  
  <p>I Have it working just using the index from the minimum value but I still need to find a way to work backward at the same time from the max. </p>
  
  <pre><code>def selectionsort(alist):
  
      for i in range(len(alist)): 
  
          min_idx = i 
          for j in range(i+1, len(alist)): 
              if alist[min_idx] &gt; alist[j]: 
                  min_idx = j 
  
          temp = alist[i]
          alist[i] = alist[min_idx]
          alist[min_idx] = temp
  
  alist = [54,26,93,17,77,31,44,55,20]
  selectionsort(alist)
  print(alist)
  </code></pre>
  
  <p>The function should return the orderd list: [17, 20, 26, 31, 44, 54, 55, 77, 93]</p>