• PUDN用户
    了解作者
  • Java
    开发工具
  • 130KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 3
    下载次数
  • 2007-11-12 19:40
    上传日期
本程序提供了各种排序算法及演示,由java实现,可以清楚看到各算法的流程演示.
allsort.rar
  • allsort
  • Slider.java
    2.3KB
  • HeapSortApp.class
    10.6KB
  • YesNoBox.java
    3.9KB
  • Node.java
    242B
  • ProgramCanvas.java
    4.1KB
  • SelectionSortApp.java
    9.3KB
  • AboutBox.class
    4.1KB
  • ColorButton.java
    487B
  • ArrayCanvas.class
    5.8KB
  • AboutBox.java
    4KB
  • Slider.class
    2.2KB
  • MergeSortApp.class
    10.4KB
  • SortInfo.class
    1005B
  • Legend$1.class
    655B
  • Legend.class
    2.3KB
  • AboutBox$1.class
    536B
  • YesNoBox$1.class
    536B
  • CharArray.java
    6.7KB
  • MessageBox.class
    4KB
  • ShearSortApp.java
    21.4KB
  • ShearSortApp.class
    12.5KB
  • StackArea.class
    3KB
  • SortApp.class
    13.2KB
  • ArrayException.class
    433B
  • ArrayException.java
    313B
  • ImageCanvas.java
    1.9KB
  • Box.class
    1.8KB
  • InsertionSortApp.java
    11.1KB
  • Stack.java
    1.1KB
  • ProgramCanvas.class
    3.3KB
  • ColorButton.class
    767B
  • example2.html
    477B
  • CharArray.class
    3.4KB
  • ImageCanvas.class
    2.5KB
  • SortStarter.java
    17.4KB
  • ArrayCanvas.java
    8.7KB
  • OETransSortApp.java
    12.7KB
  • CompareTable.java
    4.2KB
  • SelectionSortApp.class
    6.9KB
  • SortStarter.class
    11.5KB
  • HelpWindow.java
    4.8KB
  • Box.java
    1.6KB
  • ShellSortApp.class
    8.5KB
  • Legend.java
    2.4KB
  • SortApp$1.class
    818B
  • example1.html
    553B
  • BubbleSortApp.class
    7.2KB
  • Node.class
    407B
  • QuickSortApp.java
    13.1KB
  • SortInfo.java
    710B
  • HelpWindow.class
    5.4KB
  • MessageBox.java
    3.8KB
  • Stack.class
    1.1KB
  • HeapSortApp.java
    16.5KB
  • CompareTable$1.class
    550B
  • HelpWindow$1.class
    679B
  • Slider$1.class
    752B
  • QuickSortApp.class
    9KB
  • OETransSortApp.class
    8.2KB
  • InsertionSortApp.class
    7.6KB
  • ShellSortApp.java
    14KB
  • CompareTable.class
    3.8KB
  • StackArea.java
    2.9KB
  • YesNoBox.class
    4.1KB
  • SortApp.java
    18.5KB
  • BubbleSortApp.java
    9.9KB
  • MergeSortApp.java
    17.2KB
  • MessageBox$1.class
    540B
  • www.pudn.com.txt
    218B
内容介绍
// ShearSortApp.java import java.awt.*; public class ShearSortApp extends SortApp { private static final int logIndex = 0, iIndex = 1, loIndex = 2, powIndex = 3, jIndex = 4, hiIndex = 5, rowsIndex = 6, kIndex = 7, upIndex = 8, colsIndex = 9, nIndex = 10, offsetIndex = 11; private int line1; public ShearSortApp(SortStarter ss, boolean runsFromApplet, String _arrayString, CompareTable table, int[] array) { super(ss, runsFromApplet, SortStarter.HEAP, "Shearsort", table, array != null); arrayString = _arrayString; if (isSpecial) { A = array; AToCopy(); copyToRandomCopy(); } algCode = new String[31]; algCode[0] = "SHEARSORT (A)"; algCode[1] = " 1. log <- 0, pow <- 1, rows <- 1"; algCode[2] = " 2. for i <- 1 to sqrt(length[A])"; algCode[3] = " 3. do if length[A] % i = 0"; algCode[4] = " 4. then rows <- i"; algCode[5] = " 5. cols <- length[A] / rows"; algCode[6] = " 6. while (pow <= rows)"; algCode[7] = " 7. do pow <- pow * 2; log <- log + 1"; algCode[8] = " 8. for k <- 0 to log-1 do"; algCode[9] = " 9. for j <- 0 to col/2-1 do"; algCode[10] = "10. for i <- 0 to rows-1 do"; algCode[11] = "11. SORT(i*cols, (i+1)*cols, 0, 1, i%2==0)"; algCode[12] = "12. for i <- 0 to rows-1 do"; algCode[13] = "13. SORT(i*cols, (i+1)*cols, 1, 1, i%2==0)"; algCode[14] = "14. for j <- 0 to rows/2-1 do"; algCode[15] = "15. for i <- 0 to cols-1 do"; algCode[16] = "16. SORT(i, rows*cols+i, 0, cols, true)"; algCode[17] = "17. for i <- 0 to cols-1 do"; algCode[18] = "18. SORT(i, rows*cols+i, cols, cols, true)"; algCode[19] = "19. for j <- 0 to cols/2 do"; algCode[20] = "20. for i <- 0 to rows-1 do"; algCode[21] = "21. SORT(i*cols, (i+1)*cols, 0, 1, true)"; algCode[22] = "22. for i <- 0 to rows-1 do"; algCode[23] = "23. SORT(i*cols, (i+1)*cols, 1, 1, true)"; algCode[24] = "\n"; algCode[25] = "SORT (lo, hi, offset, n, up)"; algCode[26] = "1. j <- lo + offset"; algCode[27] = "2. while (j+n < hi) do"; algCode[28] = "3. if up && A[j] > A[j+n] or !up && A[j] < A[j+n]"; algCode[29] = "4. then exchange A[j] <-> A[j+n]"; algCode[30] = "5. j <- j + 2 * n"; program = new ProgramCanvas(algCode); Panel programPanel = new Panel(); programPanel.setLayout(new GridBagLayout()); gbc.insets = new Insets(0, 0, 0, 0); gbc.anchor = GridBagConstraints.CENTER; gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.weightx = 0; gbc.weighty = 100; gbc.fill = GridBagConstraints.BOTH; programPanel.add(new Canvas(), gbc); gbc.weighty = 0; programPanel.add(program, gbc); gbc.weighty = 100; programPanel.add(new Canvas(), gbc); numOfVars = 12; labels = new Label[numOfVars]; labels[0] = new Label("log: ", Label.RIGHT); labels[1] = new Label("i: ", Label.RIGHT); labels[2] = new Label("lo: ", Label.RIGHT); labels[3] = new Label("pow: ", Label.RIGHT); labels[4] = new Label("j: ", Label.RIGHT); labels[5] = new Label("hi: ", Label.RIGHT); labels[6] = new Label("rows: ", Label.RIGHT); labels[7] = new Label("k: ", Label.RIGHT); labels[8] = new Label("up: ", Label.RIGHT); labels[9] = new Label("cols: ", Label.RIGHT); labels[10] = new Label("n: ", Label.RIGHT); labels[11] = new Label("offset: ", Label.RIGHT); variables = new TextField[numOfVars]; for(int i = 0; i < numOfVars; i++) { variables[i] = new TextField(2); variables[i].setEditable(false); variables[i].setBackground(Color.white); } arrayPointers = new String[3]; arrayPointers[0] = ""; arrayPointers[1] = "j"; arrayPointers[2] = "j+n"; arrayPointersPos = new int[3]; Panel varPanel1 = new Panel(); varPanel1.setLayout(new GridLayout(3, 2)); for(int i = 0; i < 3; i++) { varPanel1.add(labels[i]); varPanel1.add(variables[i]); } Panel varPanel2 = new Panel(); varPanel2.setLayout(new GridLayout(3, 2)); for(int i = 3; i < 6; i++) { varPanel2.add(labels[i]); varPanel2.add(variables[i]); } Panel varPanel3 = new Panel(); varPanel3.setLayout(new GridLayout(3, 2)); for(int i = 6; i < 9; i++) { varPanel3.add(labels[i]); varPanel3.add(variables[i]); } Panel varPanel4 = new Panel(); varPanel4.setLayout(new GridLayout(3, 2)); for(int i = 9; i < 12; i++) { varPanel4.add(labels[i]); varPanel4.add(variables[i]); } Panel variablesPanel = new Panel(); variablesPanel.setLayout(new FlowLayout()); variablesPanel.add(varPanel1); variablesPanel.add(varPanel2); variablesPanel.add(varPanel3); variablesPanel.add(varPanel4); Panel arrayVarPanel = new Panel(); arrayVarPanel.setLayout(new GridBagLayout()); gbc.insets = new Insets(0, 5, 0, 5); gbc.anchor = GridBagConstraints.CENTER; gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.weightx = 100; gbc.weighty = 100; gbc.fill = GridBagConstraints.BOTH; arrayVarPanel.add(arrayPane, gbc); gbc.insets = new Insets(0, 0, 0, 0); gbc.anchor = GridBagConstraints.CENTER; gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.weightx = 0; gbc.weighty = 0; gbc.fill = GridBagConstraints.NONE; arrayVarPanel.add(variablesPanel, gbc); setLayout(new GridBagLayout()); gbc.insets = new Insets(0, 0, 0, 0); gbc.anchor = GridBagConstraints.NORTH; gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.weightx = 100; gbc.fill = GridBagConstraints.HORIZONTAL; add(topPanel, gbc); gbc.anchor = GridBagConstraints.CENTER; gbc.gridwidth = 1; gbc.weightx = 0; gbc.weighty = 100; gbc.fill = GridBagConstraints.BOTH; add(new Box(programPanel, algorithmName + " Algorithm", Box.LEFT), gbc); Panel rightPanel = new Panel(); rightPanel.setLayout(new GridBagLayout()); gbc.anchor = GridBagConstraints.WEST; gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.weightx = 100; gbc.weighty = 0; gbc.fill = GridBagConstraints.HORIZONTAL; rightPanel.add(new Box(inputPanel, "Array Data", Box.LEFT), gbc); gbc.anchor = GridBagConstraints.CENTER; gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.weightx = 100; gbc.fill = GridBagConstraints.BOTH; rightPanel.add(new Box(speedPanel, "Speed Controls", Box.LEFT), gbc); gbc.anchor = GridBagConstraints.CENTER; gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.weightx = 100; gbc.weighty = 100; gbc.fill = GridBagConstraints.BOTH; rightPanel.add(new Box(arrayVarPanel, "Array and Pointers", Box.LEFT), gbc); gbc.anchor = GridBagConstraints.CENTER; gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.weightx = 100; gbc.weighty = 0; gbc.fill = GridBagConstraints.BOTH; rightPanel.add(new Box(statsPanel, "Algorithm Statistics", Box.LEFT), gbc); gbc.anchor = GridBagConstraints.EAST; gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.weightx = 100; gbc.weighty = 0; gbc.fill = GridBagConstraints.BOTH; rightPanel.add(new Box(buttonPanel, "User Options", Box.LEFT), gbc); gbc.anchor = GridBagConstraints.CENTER; gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.weightx = 100; gbc.weighty = 100; gbc.fill = GridBagConstraints.BOTH; add(rightPanel, gbc);
评论
    相关推荐
    • matlabcnhelp.rar
      matlab中文帮助很难找的,快速下载
    • MobilePolice.rar
      移动警察,车牌识别,车牌定位系统源代码,已经运用在移动车载稽查系统中。
    • SVM(matlab).rar
      支持向量机(SVM)实现的分类算法源码[matlab]
    • svm.zip
      用MATLAB编写的svm源程序,可以实现支持向量机,用于特征分类或提取
    • Classification-MatLab-Toolbox.rar
      模式识别matlab工具箱,包括SVM,ICA,PCA,NN等等模式识别算法,很有参考价值
    • VC++人脸定位实例.rar
      一个经典的人脸识别算法实例,提供人脸五官定位具体算法及两种实现流程.
    • QPSK_Simulink.rar
      QPSK的Matlab/Simulink的调制解调仿真系统,给出接收信号眼图及系统仿真误码率,包含载波恢复,匹配滤波,定时恢复等重要模块,帮助理解QPSK的系统
    • LPRBPDemo2009KV.rar
      车牌识别,神经网络算法,识别率高达95%,识别时间低于80ms。
    • MODULATION.RAR
      这个源程序代码包提供了通信系统中BPSK,QPSK,OQPSK,MSK,MSK2,GMSK,QAM,QAM16等调制解调方式 用matlab的实现,以及它们在AWGN和Rayleigh信道下的通信系统实现及误码率性能
    • algorithms.rar
      十大算法论文,包括遗传算法,模拟退火,蒙特卡罗法等等,对于初学者很有帮助!!