摘要: 高精度加法 string HighPrecisionPlus(string a, string b) { string ans; reverse(a.begin(), a.end()); //逆置数字字符串,从最后一位开始处理 reverse(b.begin(), b.end()); int car 阅读全文
posted @ 2021-01-31 11:11 埃利安里 阅读(50) 评论(0) 推荐(0)
摘要: 带头结点单链表逆置 方法一:头插法 void Reverse(ListNode* root) { ListNode* p = root->next; root->next = NULL; while (p != NULL) { ListNode* temp = p->next; p->next = 阅读全文
posted @ 2021-01-09 00:51 埃利安里 阅读(79) 评论(0) 推荐(0)
摘要: 逆置顺序表 void ReverseFunction(vector<int>& v) { for (int i = 0; i < (int)v.size() / 2; i++) { swap(v[i], v[(int)v.size() - i - 1]); } } reverse(v.begin() 阅读全文
posted @ 2021-01-08 23:05 埃利安里 阅读(48) 评论(0) 推荐(0)
摘要: 文章介绍算法、算法特性、时间复杂度和空间复杂度等相关概念。 阅读全文
posted @ 2021-01-03 17:11 埃利安里 阅读(130) 评论(0) 推荐(0)
摘要: 文章介绍数据、数据元素、数据结构和抽象数据类型ADT等相关概念。 阅读全文
posted @ 2021-01-03 17:09 埃利安里 阅读(109) 评论(0) 推荐(0)
摘要: 文章介绍C程序设计中的运算符优先级。 阅读全文
posted @ 2021-01-03 15:16 埃利安里 阅读(106) 评论(0) 推荐(0)
摘要: 高效递归 对于偶数,xn=xn/2*xn/2;对于奇数,xn=x^(n-1)/2^*x^(n-1)/2^*x。时间复杂度为对数级。 long long foo(long long x, int n) { if (n == 0) { return 1; } if (n % 2 == 1) { retu 阅读全文
posted @ 2021-01-02 23:21 埃利安里 阅读(64) 评论(0) 推荐(0)
摘要: 欧几里得算法计算最大公约数和最小公倍数。 阅读全文
posted @ 2021-01-02 23:18 埃利安里 阅读(58) 评论(0) 推荐(0)
摘要: 求解最大连续子序列和问题可用的三种算法:循环遍历、分治算法和分析简化。 阅读全文
posted @ 2021-01-01 20:10 埃利安里 阅读(84) 评论(0) 推荐(0)
摘要: 关于参数传递,C中只有call-by-value,而C++中除call-by-value外,还有call-by-reference、call-by-rvalue-reference和call-by-constant-reference。 阅读全文
posted @ 2021-01-01 15:57 埃利安里 阅读(100) 评论(0) 推荐(0)