随笔分类 - 算法
对常见的应用归纳其算法
摘要:把电子磅秤,1吨电子磅秤,2吨电子磅秤,3吨电子磅秤改成1吨电子磅秤,3吨电子磅秤,2吨电子磅秤,电子磅秤private void button1_Click(object sender, EventArgs e) { string strArr = txtSource.Text.Trim(); string[] SourceStr= strArr.Split(new char[2] { ',', ',' }); //支持中英文逗号 string[]NewStr = RandomSort(SourceStr); string strResult="&q
阅读全文
摘要:非递归算法求Fibonacci比递归算法效率更优!public static int Fibonacci(int n) { int Result = 1; int temp1 = 0, temp2 = 1, j = 3; if (n == 1) { Result = 1; return Result; } else if (n == 2) { Result = 1; return Result; } while (j = n) { temp1 = temp2; temp2 = Result; Result = temp1 + temp2; j++; } return Result; }
阅读全文
浙公网安备 33010602011771号