摘要: using System;using System.Collections.Generic;using System.Text;namespace ConsoleApplication2{ public class SuanFa { //求十进制数转换2进制后会有几个1 public static int Number1(int n) { //n = Convert.ToInt32(Console.ReadLine()); int x = 0; while (true) { while (n != 0) { if ((n & 1) == 1) x++; n = n >> 1 阅读全文
posted @ 2013-08-25 16:43 爱起早的小D 阅读(414) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Text;using System.Collections;namespace ConsoleApplication2{ class StringSuan { //字符串是否包含问题 A中的字符是否在B中出现 public static void Contains() { string str1 = "ggwahrah"; string str2 = "gwha"; // 开辟一个辅助数组并清零 int[] hash = new int[ 阅读全文
posted @ 2013-08-25 16:41 爱起早的小D 阅读(393) 评论(0) 推荐(1) 编辑
摘要: 第一篇博客就整理下排序算法吧 ,欢迎大家批评指正using System;using System.Collections.Generic;using System.Text;namespace ConsoleApplication2{ class Sort { //二分查找 public static int Search(int[] data, int val) { if (data.Length middle && j > left) j--; if (i left) QuickSearch(dataArray, left, j); if (i array[j]) 阅读全文
posted @ 2013-08-25 16:31 爱起早的小D 阅读(214) 评论(0) 推荐(0) 编辑