zoukankan      html  css  js  c++  java
  • [原创]冒泡排序BubbleSort Virus

     public class BubbleSort
        {
            private int [] mylist;

            public BubbleSort()
            {
                mylist = new int[12] { 19, 13, 5, 27, 1, 26, 31, 16, 2, 9, 11, 21 };
            }
            public void Pad()
            {
               
               
            }
            public void StartSort()
            {
                int temp = 0;
                int f = mylist.Length-1;
                for (int i = 0; i < f; i++)
                {
                    int k = 0;
                    for (int j = k; j < f - k; j++)
                    {
                        if (mylist[j] > mylist[j + 1])
                        {
                            temp = mylist[j];
                            mylist[j] = mylist[j + 1];
                            mylist[j + 1] = temp;
                        }
                    }
                }
            }
            public void Display()
            {
                for (int i = 0; i < mylist.Length; i++)
                {
                    Console.WriteLine(mylist[i]);
                }
            }
          
           
        }
    class Program
        {
            static void Main(string[] args)
            {
                BubbleSort bb = new BubbleSort();

                bb.StartSort();
                bb.Display();
                Console.ReadLine();
            }
        }

    【Blog】http://virusswb.cnblogs.com/

    【MSN】jorden008@hotmail.com

    【说明】转载请标明出处,谢谢

    反馈文章质量,你可以通过快速通道评论:

  • 相关阅读:
    YAML语法
    Python tab补全
    Ubuntu开启root用户登录
    Windows部署JDK和Tomcat
    驾校宝典之科目一整理
    VMware之Red Hat安装配置部署
    H3C之VRRP实验部署
    Windows Server实验指导
    基础网络配置与管理综合实验报告
    H3C-VLan配置
  • 原文地址:https://www.cnblogs.com/virusswb/p/852440.html
Copyright © 2011-2022 走看看