随笔分类 - 算法
摘要:class Program { static void Main(string[] args) { string str = Console.ReadLine(); Console.WriteLine(ReverseByFun(str)); Console.WriteLine(ReverseByArray(str)); } /// /// 方法一 /// /// 待反转字符串 /// ...
阅读全文
摘要://冒泡排序 private static void SortByMP() { int[] array = new int[] { 23, 33, 34, 143, 167, 278, 179, 108 }; int temp; for (int i = 0; i array[j]) { temp = array[i]; array[i] = array[...
阅读全文
摘要:private static void QueryByMid() { int[] array = new int[] { 23, 33, 34, 43, 67, 78, 79 }; int low = 0; int high = array.Length - 1;//这句很重要,减1避免数组值比较时索引超出 int mid = 0; int queryNum = 78;//待查找的数 int queryIndex = -1; ...
阅读全文


浙公网安备 33010602011771号