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

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

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

  • 相关阅读:
    SubVerSion 快速入门教程
    利用JQuery的$.ajax()可以很方便的调用asp.net的后台方法
    函数式编程初探(functional programming)
    用Openfire架设自己的即时聊天服务器
    把DataTable中的身份证号导出excel的解决方案
    jQuery Ajax 全解析
    总结使用Cookies的一些问题
    VS2008 AJAX控件介绍
    支付宝服务接口,实现虚拟交易和实物交易
    Qt QElapsedTimer
  • 原文地址:https://www.cnblogs.com/virusswb/p/852440.html
Copyright © 2011-2022 走看看