
剑指offer
文章平均质量分 58
lixiaomiaolixiaomiao
遗传算法研究
展开
-
高质量代码
剑指offer 重新阅读小心得原创 2016-09-30 15:40:59 · 191 阅读 · 0 评论 -
c++ 分析现有代码错误
class A{private: int value;public: A(int n) { value = n; } A(const A &other)//注意剑指offer里面此处把拷贝构造函数形参变为引用类型还是出错,必须是常量引用才行 { cout value原创 2016-09-30 16:30:24 · 325 阅读 · 0 评论 -
赋值操作符防止自身赋值的细节
CMyString& CMyString::operator=(const CMyString& Str){ cout if (this != &Str) { CMyString strTemp(Str); char* pTemp = strTemp.m_pData; strTemp.m_pData原创 2016-09-30 17:40:00 · 837 阅读 · 1 评论 -
字符串替换。在原有字符串空间足够的情况下改变字符串中若干字符
#include #include #include using namespace std;void turn(char* res, char* des, int n){ if (res == NULL) return ; int i, j; const int resSize = strlen(res); f原创 2016-10-03 19:46:46 · 255 阅读 · 0 评论 -
链表中头结点必须为二级指针及原因
链表操作原创 2016-10-03 20:26:18 · 1401 阅读 · 0 评论 -
根据先序遍历和中序遍历得出二叉树。最终以后序遍历的形式输出。
以最简单基本地实现了根据二叉树先序遍历中序遍历建树最后以后序遍历的方式输出。供理解。有不当的地方也在持续更改中#includeusing namespace std;struct BinaryTreeNode{ int value; BinaryTreeNode* left; BinaryTreeNode* right;};//int befo原创 2016-10-03 22:35:26 · 588 阅读 · 0 评论 -
二叉树先序遍历中序遍历结果得出该树,并以后序遍历形式输出
简单形式写下思想。仅供交流。有问题还望指正。#includeusing namespace std;struct BinaryTreeNode{ int value; BinaryTreeNode* left; BinaryTreeNode* right;};//int beforeSequence[8] = {1, 2, 4, 7, 3, 5原创 2016-10-03 22:38:16 · 458 阅读 · 0 评论