zoukankan      html  css  js  c++  java
  • 选择排序 C#

    1.

     1  class Program
     2     {
     3         static void Main(string[] args)
     4         {
     5             int[] iArrary = new int[] { 1536105592871234753347 };
     6             SelectionSorter ss = new SelectionSorter();
     7             ss.Sort(iArrary);
     8             for (int m = 0; m < iArrary.Length; m++)
     9             {
    10                 Console.Write("{0} ", iArrary[m]);
    11             }
    12             Console.ReadLine();
    13        }  

    14     }


     2.选择排序

     1   class SelectionSorter
     2     {
     3         private int min;
     4         /// <summary>
     5         /// 选择排序
     6         /// </summary>
     7         public void Sort(int[] list)
     8         {
     9             for (int i = 0; i < list.Length - 1; i++)
    10             {
    11                 min = i;
    12                 for (int j = i + 1; j < list.Length; j++)
    13                 {
    14                     if (list[j] < list[min])
    15                         min = j;
    16                 }
    17                 int t = list[min];
    18                 list[min] = list[i];
    19                 list[i] = t;
    20             }
    21         }

    22     } 

    乌龟才背着房子过一辈子
  • 相关阅读:
    第四次作业—— 分析比较各种软件构建环境
    如何实现点击事件触发之后刷新还保存原值
    简单理解js闭包
    javascript中 __proto__与prorotype的理解
    原生和jQuery的ajax用法
    getElementById和querySelector方法的区别
    关于javascript闭包理解
    第二篇 进销存管理系统冲刺博客
    个人项目:WC
    自我介绍+软工五问
  • 原文地址:https://www.cnblogs.com/Yellowshorts/p/3083606.html
Copyright © 2011-2022 走看看