⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 selectionsort.java

📁 java实现的各种排序算法:插入排序、起泡排序、希尔排序等。
💻 JAVA
字号:
package org.rut.util.algorithm.support; 


/** 
* @author treeroot 
* @since 2006-2-2 
* @version 1.0 
*/ 
public class SelectionSort implements SortUtil.Sort { 

   /* 
    * (non-Javadoc) 
    * 
    * @see org.rut.util.algorithm.SortUtil.Sort#sort(int[]) 
    */ 
   public void sort(int[] data) { 
       int temp; 
       for (int i = 0; i < data.length; i++) { 
           int lowIndex = i; 
           for (int j = data.length - 1; j > i; j--) { 
               if (data[j] < data[lowIndex]) { 
                   lowIndex = j; 
               } 
           } 
           SortUtil.swap(data,i,lowIndex); 
       } 
   } 

} 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -