摘要:
前段时间学习了CMU15-445 2021fall的DBMS课程,最近春招将近,作为复习,将四个project的实验重新梳理一下。 上图中的buffer pool部分即为本project的主要内容。 buffer pool可以用memory mapping (mmap)将文件中的内容存储在程序的地址 阅读全文
posted @ 2022-03-01 21:59
fwx
阅读(232)
评论(0)
推荐(0)
摘要:
class Solution { public: void dfs(int index, vector<string> &cur_board){ if (index == nn){ result.push_back(cur_board); } else{ int x, y = index; for( 阅读全文
posted @ 2022-03-01 16:54
fwx
阅读(20)
评论(0)
推荐(0)
摘要:
位运算可以大大降低运算难度!!! class Solution { public: void print(vector<vector<char>>& board){ for(auto b: board){ for(auto a: b){ cout << a << " "; } cout << end 阅读全文
posted @ 2022-03-01 16:51
fwx
阅读(24)
评论(0)
推荐(0)
摘要:
78. 子集 class Solution { public: void dfs(vector<int>& nums, vector<int> &cur, int index){ if(index > num_len) return; result.push_back(cur); for(int i 阅读全文
posted @ 2022-03-01 16:45
fwx
阅读(25)
评论(0)
推荐(0)
摘要:
组合总和 class Solution { public: void dfs(vector<int>& candidates, vector<int> &cur, int index, int sum){ if(sum == target) result.push_back(cur); else{ 阅读全文
posted @ 2022-03-01 16:41
fwx
阅读(28)
评论(0)
推荐(0)
摘要:
未优化剪枝版: class Solution { public: void dfs(vector<bool> &record, vector<int> &cur, int index){ if(cur.size() == kk) result.emplace_back(cur); else{ for 阅读全文
posted @ 2022-03-01 16:27
fwx
阅读(9)
评论(0)
推荐(0)
摘要:
注意是对原数组进行交换!!! class Solution { public: void dfs(vector<int>& nums, int index){ if(index == num_len){ result.push_back(nums); return; } for(int i=inde 阅读全文
posted @ 2022-03-01 16:24
fwx
阅读(23)
评论(0)
推荐(0)
摘要:
class Solution { public: bool is_get(int x, int y){ if(x >= 0 && x < len_x && y >= 0 && y < len_y) return true; return false; } int dfs(vector<vector< 阅读全文
posted @ 2022-03-01 14:15
fwx
阅读(14)
评论(0)
推荐(0)
摘要:
无脑深搜两次,一次判断是否位于内部,一次变‘X’ class Solution { public: bool is_inside(int x, int y){ if (x > 0 && x < len_x - 1 && y > 0 && y < len_y - 1) return true; ret 阅读全文
posted @ 2022-03-01 14:00
fwx
阅读(19)
评论(0)
推荐(0)
摘要:
就开心愉快的dfs即可~ class Solution { public: int get_record(int *record, int x, int y){ return record[x * len_y + y]; } void set_record(int *record, int x, i 阅读全文
posted @ 2022-03-01 13:54
fwx
阅读(22)
评论(0)
推荐(0)
摘要:
class Solution { public: bool is_cross(string &word1, string &word2){ bool flag = true; for(int i=0;i<word_length;++i) if(word1[i] != word2[i]) if(fla 阅读全文
posted @ 2022-03-01 13:52
fwx
阅读(29)
评论(0)
推荐(1)
摘要:
和路径权重的最短路径有些类似,可以用相同的方式做。 class Solution { public: int numSquares(int n) { queue<int> n_q; int dp[n+1]; bool is_go[n+1]; for(int i=1;i<=n;++i) { dp[i] 阅读全文
posted @ 2022-03-01 13:21
fwx
阅读(28)
评论(0)
推荐(0)
摘要:
class Solution { public: void bfs(vector<vector<int>>& grid){ record[0][0] = 1; p_q.push(make_pair(0,0)); int cur_x, cur_y; int len_x = grid.size(); i 阅读全文
posted @ 2022-03-01 12:47
fwx
阅读(24)
评论(0)
推荐(0)
摘要:
思路:dfs, 然后用map记录每个数字对应的树,以优化搜索。 map中key为自定义数据结构时,使用仿函数来添加键的比较方式。 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *l 阅读全文
posted @ 2022-03-01 12:19
fwx
阅读(56)
评论(0)
推荐(0)
摘要:
用运算符作为分割,对两边的表达式进行求值,分而治之; class Solution { public: int calc(int left, int right, char op){ switch (op){ case '+': return left + right; case '-': retu 阅读全文
posted @ 2022-03-01 11:59
fwx
阅读(27)
评论(0)
推荐(0)
摘要:
思路:记录字符串s中每个字母出现的最右边的位置(如果要记录左侧位置,则需要排序,这里可以不用),然后遍历字符串,记录left和right两个下标, left:区间的左边界; right:区间的右边界; 如果当前遍历的字符的最右边位置大于等于右边界,则更新右边界,如果当前遍历的下标大于右边界,则将le 阅读全文
posted @ 2022-03-01 11:50
fwx
阅读(31)
评论(0)
推荐(0)
摘要:
身高 h 降序、个数 k 值升序,然后将某个学生插入队列的第 k 个位置中。 class Solution { public: vector<vector<int>> reconstructQueue(vector<vector<int>>& people) { sort(people.begin( 阅读全文
posted @ 2022-03-01 11:39
fwx
阅读(23)
评论(0)
推荐(0)

浙公网安备 33010602011771号