摘要: #include <iostream> struct i_uintptr_t { i_uintptr_t(): ptr{} {} i_uintptr_t(uintptr_t ptr): ptr{ptr} {} ~i_uintptr_t() { ptr = 0; } operator uintptr_ 阅读全文
posted @ 2024-06-21 10:07 joel-q 阅读(1) 评论(0) 推荐(0) 编辑
摘要: Bison The Yacc-compatible Parser Generator 10 September 2021, Bison Version 3.8.1 by Charles Donnelly and Richard Stallman 目录Bison1 The Concepts of Bi 阅读全文
posted @ 2024-06-12 20:18 joel-q 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 98. 验证二叉搜索树 递归 class Solution { TreeNode *leftMost; TreeNode *rightMost; bool limitYourself(TreeNode *root, int min, int max) { if (root == nullptr) { 阅读全文
posted @ 2024-03-13 21:54 joel-q 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 小白debug 阅读全文
posted @ 2024-03-12 16:03 joel-q 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 1. 两数之和 space: \(O(n)\) time: \(O(n)\) class Solution { using index = pair<int, int>; static bool compare(index a, index b) { return a.second < b.seco 阅读全文
posted @ 2024-03-11 23:57 joel-q 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 20. 有效的括号 std::stack<T>的几个方法: top:相当于back pop:相当于pop_back push: 相当于push_back class Solution { public: static char leftOf(char c) { switch (c) { case ' 阅读全文
posted @ 2024-03-09 17:31 joel-q 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 三分学 七分练 leetcode 21 合并两个有序链表 尾插法 头结点 #include <iostream> using namespace std; struct ListNode { int val; ListNode *next; ListNode() : val(0), next(nul 阅读全文
posted @ 2024-03-07 21:26 joel-q 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 收集一些不错的学习资料 cmake实战入门 PROJECT(HELLO)生成工程名 ADD_EXECUTABLE(hello main.cpp)以右侧参数生成左侧目标参数 ADD_SUBDIRECTORY(src bin)将左侧子目录下生成的目标移动到bin目录下 安装 CMAKE_INSTALL_ 阅读全文
posted @ 2023-02-11 14:47 joel-q 阅读(27) 评论(0) 推荐(0) 编辑
摘要: ## 第一部分 并发理论基础 ### 01 可见性、原子性和有序性 举几个例子先。 1. 缓存可能导致**可见性**问题,因为多核CPU上的多个核可能都持有同一数据的不同缓存。两个线程并行地对一个字段进行累加,结果介于一倍与两倍之间。关键字volatile就是为了这样的需求,它提示底层去掉缓存这样的 阅读全文
posted @ 2023-02-01 00:36 joel-q 阅读(162) 评论(1) 推荐(0) 编辑
摘要: https://book.douban.com/annotation/121895489/ 深度探索C++对象模型 笔记 封装 对象持有自己的数据,等价于C语言的结构体,保持了访问速度。就是说,C++中,class对象就是struct,而不是像Java中的对象那样均是引用;C++的对象就是对象本身, 阅读全文
posted @ 2023-01-25 11:51 joel-q 阅读(40) 评论(3) 推荐(0) 编辑