Sort algorithm

xiaoxiao2021-03-06  14

/ * * Create Date 2005-3-16 * * Todo To change this generated file template, go to * Window - Preference - Java - Code Style - Code Template * / package com.pub.reorder;

Import java.util.arraylist;

/ ** * @Author Explorerwen * * Todo To change this generated type annotation template, go to * Window - Preference - Java - Code - Code Template * / Public Final Class REORDER {Private Static REORDER REORDER = NULL; Private reorder () {} / ** * Get an instance * @return * / public static reorder getreorder () {if (reorder == null) REORDER = new reorder (); return reporder;} / ** * Use "," Split string * @Param str * @Return * / private static string [] splitred (string str) {string t [] = null; t = str.split (","); returnit t;} / ** * Bubble Sort Basic Algorithm * * @Param R * @Return * / Private Static String [] bubble (String [] R) {INT i = 0; INT J = 0; String Temp = ""; Boolean Flag = False; for (i = 0; i

Return * / private static string [] Quick (String [] r, int low, int high) {int pivotpos = 0; if (low = integer.parseint (pivot)) j -; if (i

} / ** * Direct insertion sort * @Param r * @return * / public string [] insertred (String [] r) {Return INSERT (R);} / ** * Direct insertion sort * @Param str * @return * / Public string [] INSERTRED (STRING STR) {Return INSERT (SplitRed (STR));} / ** * Direct Insert Sort Sort * @Param Alist * @return * / Public String [] InsertRed (arraylist alist) {String STR = ""; For (int i = 0; i 1); return r;} private static voidpass (string [] r, int d) {string Temp = ""; Int J = 0, i = 0; for (i = D; i -1 && Integer.Parseint (TEMP)

Return REORDER.GETREORDER (). Shellred (STR);} / ** * Direct selection Basic Algorithm * @Param R * @return * / private static string [] select (string [] r) {Int i = 0, J = 0, k = 0; string temp = ""; for (i = 0; i

转载请注明原文地址:https://www.9cbs.com/read-46516.html

New Post(0)