01 2021 档案
重建二叉树*
摘要:struct BinaryTreeNode { int nValue; BinaryTreeNode* pLeft; BinaryTreeNode* pRight; }; BinaryTreeNode* ConstructCore(int* startPreorder, int* endPreord 阅读全文
posted @ 2021-01-26 15:53 Noora&w 阅读(64) 评论(0) 推荐(0)
从尾到头打印链表
摘要://栈 void printList(ListNode* pHead) { std::stack<ListNode*> printStack; ListNode* pTemp = pHead; while (pTemp != nullptr) { printStack.push(pTemp); pT 阅读全文
posted @ 2021-01-21 19:59 Noora&w 阅读(55) 评论(0) 推荐(0)
替换空格
摘要:void replace(char* data, int length) { if (data == nullptr || length <= 0) return; int nEmptyNumber = 0; int nOrignialLength = 0; int i = 0; while(dat 阅读全文
posted @ 2021-01-21 17:31 Noora&w 阅读(144) 评论(0) 推荐(0)
二维数组中的查找
摘要:bool find(int* data, int rows, int columns, int number) { if (data == nullptr || rows <= 0 || columns <= 0) return false; bool bfind = false; int row 阅读全文
posted @ 2021-01-21 15:04 Noora&w 阅读(61) 评论(0) 推荐(0)
单例模式
摘要://饿汉模式:即类产生的时候就创建好实例对象,这是一种空间换时间的方式 class CSingleton { public: ~CSingleton() {}; CSingleton(const CSingleton&); CSingleton& operator=(const CSingleton 阅读全文
posted @ 2021-01-21 11:45 Noora&w 阅读(54) 评论(0) 推荐(0)
赋值运算符函数
摘要:已知类: class CMyString { public: CMyString(char* pData = NULL); CMyString(const CMyString& str); ~CMyString(void); private: char* m_pData; }; 初级实现: CMyS 阅读全文
posted @ 2021-01-20 15:24 Noora&w 阅读(133) 评论(0) 推荐(0)