03 2012 档案

摘要:static int FindMax(int[][] array) { int max = -1; if (array == null || array.Length == 0) { return max; } for (int i = 0; i < array.Length; i++) { if (array[i] != null) { ... 阅读全文
posted @ 2012-03-17 07:05 Ligeance 阅读(3588) 评论(0) 推荐(0) 编辑
摘要:static int FindNumber(int[] array, int num) { int result = -1; if (array == null) { return result; } for (int i = 0; i < array.Length - 1; i++) { if (array[i] > array[i + 1]) ... 阅读全文
posted @ 2012-03-14 15:17 Ligeance 阅读(2949) 评论(0) 推荐(0) 编辑
摘要:static void InsertSort(int[] input) { if (input == null || input.Length == 0) { throw new Exception("input can't be empty."); } for (int i = 1; i < input.Length; i++) { if (input[i] < input[i - 1]) ... 阅读全文
posted @ 2012-03-14 15:02 Ligeance 阅读(177) 评论(0) 推荐(0) 编辑
摘要:static StringCollection Permutations(string input) { if (input == null) { throw new Exception("input can't be null"); } StringCollection results = new StringCollection(); char firstChar = ' '; string rema... 阅读全文
posted @ 2012-03-12 14:18 Ligeance 阅读(232) 评论(0) 推荐(0) 编辑
摘要:public interface IStack<T> { int GetLength(); bool IsEmpty(); bool IsFull(); void Clear(); void Push(T item); T Pop(); T GetTop(); } public class Stack<T> : IStack<T> { private int size; private T[] data; private i... 阅读全文
posted @ 2012-03-12 13:40 Ligeance 阅读(293) 评论(1) 推荐(1) 编辑
摘要:求一个方法,能概率性输出 A 70%, B 20%, C 6%, D 3%, E 1% static char Output() { Random rnd = new Random(); int i = rnd.Next(1, 100); if (i<=70) { return 'A'; } if (i>70 && i<=90) { return 'B';... 阅读全文
posted @ 2012-03-12 12:46 Ligeance 阅读(1464) 评论(1) 推荐(0) 编辑
摘要:假设有6个小朋友,编号为1,2,3,4,5,6。 从1数到3,然后把第3个小朋友去除,再从1数到3,把第6个小朋友去除,再从1数到3, 把第4个小朋友去除,求剩下的最后一个小朋友。 static int Func(int[] array, int count) { if (array == null || array.Length== 0 || count <1) { throw new Exception("array or count can't be empty or less than ... 阅读全文
posted @ 2012-03-12 12:09 Ligeance 阅读(249) 评论(2) 推荐(0) 编辑

点击右上角即可分享
微信分享提示