zoukankan      html  css  js  c++  java
  • 面试题记录 -- 2014年5月29日

    1.质数,1,3,5,7,X,能被1和本身整除

    2.冒泡排序

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace 冒泡排序
    {
        class Program
        {
            static void Main(string[] args)
            {
                int[] array = { 20, 40, 30, 10, 60, 50 };
                foreach (var item in array)
                {
                    Console.Write(item + " ");
                }
                Console.WriteLine("");
                int[] aa = sort(array);
                foreach (var item in aa)
                {
                    Console.Write(item + " ");
                }
                Console.ReadKey();
            }
            /// <summary>
            /// 冒泡排序
            /// </summary>
            /// <param name="m"></param>
            /// <returns></returns>
            public static int[] sort(int[] m)
            {
                //执行多少次
                for (int i = 0; i < m.Length; i++)
                {
                    //每执行1次,将最大的排在最后
                    //m.Length-1,因为 m[j + 1] <= m[5]
                    for (int j = 0; j < m.Length - 1; j++)
                    {
                        int a = m[j];
                        int b = m[j + 1];
                        if (a > b)
                        {
                            m[j + 1] = a;
                            m[j] = b;
                        }
                    }
                }
    
    
    
                return m;
            }
        }
    }
    

    image

    3.SQL分页,row=30,page=5

    用ROW_NUMBER() over(order by XX)

    select * from(
    select top(@PageSize*@PageIndex) ROW_NUMBER() over(order by ConID) as nid,* from dbo.PKE_DeviceContent
    ) as temp
    where temp.nid>(@PageSize*(@PageIndex-1))
    ORDER BY temp.ConID

    把查询的结果作为一个内查询,再在外面套上一个外查询语句:

    --@PageIndex =5
    --@PageSize=30
    select * from(
    select top(30*5) ROW_NUMBER() over(order by ConID) as nid,* from dbo.PKE_DeviceContent
    ) as temp
    where temp.nid>(30*(5-1))
    ORDER BY temp.ConID
    

    参考:http://www.cnblogs.com/tangge/archive/2012/08/29/2662094.html

    1

  • 相关阅读:
    发现可以用undef
    再改WUIBUTTON
    使用WUI点滴(一)
    关于IE里超链接失效的解决方案
    WUIButton的BUG
    GDI+ 你使用了吗?
    初次使用WUI
    判断键是否按下
    电梯坏了怎么办?
    在sdk中如何加入web浏览器的两种方法(转贴)
  • 原文地址:https://www.cnblogs.com/tangge/p/3759961.html
Copyright © 2011-2022 走看看