摘要: https://zhuanlan.zhihu.com/p/37331092 虚函数和纯虚函数 https://blog.csdn.net/u012206617/article/details/87697667 虚函数和纯虚函数 https://www.cnblogs.com/chwei2ch/p/1 阅读全文
posted @ 2020-12-27 21:50 不妨不妨,来日方长 阅读(91) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> #include<vector> using namespace std; void quick_sort(vector<int>& data, int left, int right) { if (left >= right) { return; } // 否 阅读全文
posted @ 2020-12-27 15:10 不妨不妨,来日方长 阅读(116) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> #include<vector> #include<stack> using namespace std; struct TreeNode // 定义树节点的结构 { int val; TreeNode* left; TreeNode* right; TreeN 阅读全文
posted @ 2020-12-27 14:17 不妨不妨,来日方长 阅读(91) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> #include<vector> #include<stack> using namespace std; struct TreeNode // 定义树节点的结构 { int val; TreeNode* left; TreeNode* right; TreeN 阅读全文
posted @ 2020-12-27 14:06 不妨不妨,来日方长 阅读(99) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> using namespace std; struct ListNode { int val; ListNode *next; ListNode(int x) : val(x), next(nullptr) { } }; class Solution { pub 阅读全文
posted @ 2020-12-26 22:50 不妨不妨,来日方长 阅读(97) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> #include<unordered_map> #include<vector> using namespace std; class Solution { public: vector<int> twoSum(vector<int>& nums, int ta 阅读全文
posted @ 2020-12-26 22:25 不妨不妨,来日方长 阅读(67) 评论(0) 推荐(0) 编辑
摘要: 一、最基本的二分查找,判断一个数在数组中是不是存在的问题 #include<iostream> #include<vector> using namespace std; int binary_search(vector<int>& arr, int left, int right, int tar 阅读全文
posted @ 2020-12-26 21:46 不妨不妨,来日方长 阅读(90) 评论(0) 推荐(0) 编辑
摘要: C++的内存分为:堆、栈、自由存储区、全局/静态存储区、常量存储区。 全局变量、static全局变量、static局部变量时存放在全局/静态存取区的,是在程序编译的时候,就在全局存储区分配内存的,生存期为整个程序运行,直至运行结束才会被系统回收。 全局变量和static全局变量的区别在于作用域,全局 阅读全文
posted @ 2020-12-22 09:17 不妨不妨,来日方长 阅读(657) 评论(0) 推荐(0) 编辑
摘要: 双指针分为“快慢指针“和”左右指针“ 快慢指针多用来解决链表中的问题;左右指针多用来解决数组(或者字符串)问题。 一、快慢指针的常见算法 1.判定链表中是否含有环 141 2.已知链表中含有环,返回值这个环的起始位置 142 3.寻找链表的中点,可以解决对链表进行归并排序问题 876 4.寻找链表的 阅读全文
posted @ 2020-12-19 20:59 不妨不妨,来日方长 阅读(150) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> using namespace std; int main() { int a = 8; a += a *= a /= a - 6; cout << "Result :" << a << endl; return 1; } 注意赋值运算符是从右往左结合的,所以这 阅读全文
posted @ 2020-12-19 20:55 不妨不妨,来日方长 阅读(1382) 评论(0) 推荐(0) 编辑