03 2023 档案

摘要:class Solution { public: int largestRectangleArea(vector<int>& h) { vector<int> l=vector<int>(h.size()); vector<int> r=l; stack<int> stk; int res=0; / 阅读全文
posted @ 2023-03-31 16:47 穿过雾的阴霾 阅读(12) 评论(0) 推荐(0) 编辑
摘要:class Solution { public: vector<vector<int>> res; void bfs(TreeNode* root) { queue<TreeNode*> q; q.push(root); int level=0; while(q.size ()) { int siz 阅读全文
posted @ 2023-03-31 09:21 穿过雾的阴霾 阅读(13) 评论(0) 推荐(0) 编辑
摘要:class Solution { public: vector<int> res; void bfs(TreeNode* root) { queue<TreeNode*> q; q.push(root); while(q.size ()) { auto p=q.front(); q.pop(); r 阅读全文
posted @ 2023-03-31 09:10 穿过雾的阴霾 阅读(7) 评论(0) 推荐(0) 编辑
摘要:class Solution { public: vector<vector<int>> res; void bfs(TreeNode* root) { queue<TreeNode*> q; q.push(root); while(q.size ()) { int size=q.size(); v 阅读全文
posted @ 2023-03-31 09:10 穿过雾的阴霾 阅读(11) 评论(0) 推荐(0) 编辑
摘要:class Solution { public: bool isPopOrder(vector<int> pushV,vector<int> popV) { stack<int> st; int n=pushV.size(),m=popV.size(); if(n!=m) return false; 阅读全文
posted @ 2023-03-30 13:40 穿过雾的阴霾 阅读(13) 评论(0) 推荐(0) 编辑
摘要:class Solution { public: ListNode* deleteDuplicates(ListNode* head) { ListNode* dummy=new ListNode(-1,nullptr); if(!head||!head->next) return head; Li 阅读全文
posted @ 2023-03-30 13:32 穿过雾的阴霾 阅读(10) 评论(0) 推荐(0) 编辑
摘要:class MinStack { public: stack<int> st;//普通栈 stack<int> stMin;//单调栈 /** initialize your data structure here. */ MinStack() { } void push(int x) { st.p 阅读全文
posted @ 2023-03-29 15:41 穿过雾的阴霾 阅读(12) 评论(0) 推荐(0) 编辑
摘要:class Solution { public: int turn,n,m; static const int N=410; int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};//右下左上 bool st[N][N]; bool check(int i 阅读全文
posted @ 2023-03-29 14:52 穿过雾的阴霾 阅读(8) 评论(0) 推荐(0) 编辑
摘要:class Solution { public: bool check(vector<int> &nums,int target,int l,int r)//[l,r]区间查找target { while(l<r) { int mid=(l+r+1)>>1; if(target>=nums[mid] 阅读全文
posted @ 2023-03-28 20:48 穿过雾的阴霾 阅读(10) 评论(0) 推荐(0) 编辑
摘要:class Solution { public: void mirror(TreeNode* root) { if(root==NULL) return; mirror(root->left); mirror(root->right); TreeNode* tmp=root->left; root- 阅读全文
posted @ 2023-03-28 19:25 穿过雾的阴霾 阅读(4) 评论(0) 推荐(0) 编辑
摘要:class Solution { public: bool dfs(TreeNode* l,TreeNode* r) { if(l==NULL&&r==NULL) return true; else if(l&&r) return l->val==r->val&&dfs(l->left,r->rig 阅读全文
posted @ 2023-03-28 19:25 穿过雾的阴霾 阅读(8) 评论(0) 推荐(0) 编辑
摘要:class Solution { public: bool check(TreeNode* r1, TreeNode* r2) { if(r2==NULL) return true;//如果r2为空,无论r1,都匹配成功 if(r1&&r2) { if(r1->val!=r2->val) retur 阅读全文
posted @ 2023-03-27 22:03 穿过雾的阴霾 阅读(10) 评论(0) 推荐(0) 编辑
摘要:class Solution { public: ListNode* merge(ListNode* l1, ListNode* l2) { ListNode* dummy=new ListNode(-1),*tail=dummy; while(l1&&l2) { if(l1->val>l2->va 阅读全文
posted @ 2023-03-27 21:23 穿过雾的阴霾 阅读(9) 评论(0) 推荐(0) 编辑
摘要:1. 页表大小随虚拟地址空间增加,随页面大小减小 页面太大了,不就变成了分区吗,就有外部碎片了 2. 百分比增加,valid的变多 3. 我也没看出有什么不妥 可能前两个组合对于虚拟地址空间来说太大了,最后一个组合又太小了?? 4. 想让程序不正常运行,可以让虚拟地址空间比内存大,或者虚拟地址空间大 阅读全文
posted @ 2023-03-27 16:04 穿过雾的阴霾 阅读(16) 评论(0) 推荐(0) 编辑
摘要:class Solution { public: int fac[10]; void init() { fac[0]=1; fac[1]=1; for(int i=2;i<10;i++) fac[i]=fac[i-1]*i; return; } string str; bool visited[10 阅读全文
posted @ 2023-03-25 16:24 穿过雾的阴霾 阅读(13) 评论(0) 推荐(0) 编辑
摘要:#递归 class Solution { public: ListNode* reverseList(ListNode* head) { if(head==NULL||head->next==NULL) return head; //先反转head后面的链表,最后将head接在新链表最后即可 aut 阅读全文
posted @ 2023-03-25 15:30 穿过雾的阴霾 阅读(7) 评论(0) 推荐(0) 编辑
摘要:class Solution { public: //f[i]表示跳到i所需的最小步数 int jump(vector<int>& nums) { vector<int> f(10010,0x3f3f3f3f); int n=nums.size(); f[0]=0; for(int i=0;i<n; 阅读全文
posted @ 2023-03-24 14:26 穿过雾的阴霾 阅读(17) 评论(0) 推荐(0) 编辑
摘要:class Solution { public: //f[i]表示下标i是否能跳到 static const int N=3e4+10; bool canJump(vector<int>& nums) { int n=nums.size(); for(int i=0,j=0;i<n;i++)//j记 阅读全文
posted @ 2023-03-24 14:15 穿过雾的阴霾 阅读(12) 评论(0) 推荐(0) 编辑
摘要:#方法1,遍历一次,使用额外空间 哈希直接存储指针出现的次数,如果重复出现,直接返回即可 class Solution { public: unordered_map<ListNode*,int> hashmap;//记录指针及其出现的次数+1 ListNode *entryNodeOfLoop(L 阅读全文
posted @ 2023-03-24 11:50 穿过雾的阴霾 阅读(10) 评论(0) 推荐(0) 编辑
摘要:class Solution { public: ListNode* findKthToTail(ListNode* head, int k) { auto i=head; auto j=head; int len=0; for (; len < k&&j!=NULL; len ++ ) j=j-> 阅读全文
posted @ 2023-03-23 16:22 穿过雾的阴霾 阅读(13) 评论(0) 推荐(0) 编辑
摘要:class Solution { public: int firstMissingPositive(vector<int>& nums) { int n=nums.size(); for(int i=0;i<n;i++) { while(nums[i]>0&&nums[i]<=n&&nums[i]! 阅读全文
posted @ 2023-03-23 16:01 穿过雾的阴霾 阅读(7) 评论(0) 推荐(0) 编辑
摘要:类比快排思想 class Solution { public: void reOrderArray(vector<int> &q) { if(!q.size()) return; int l=-1,r=q.size(); while(l<r) { do l++;while(l<r&&q[l]&1); 阅读全文
posted @ 2023-03-22 14:07 穿过雾的阴霾 阅读(11) 评论(0) 推荐(0) 编辑
摘要:1. 随着free的次数增加,空闲列表的元素个数增加,因为不会合并,每次分配内存时,开销也增大,内存碎片增加 2. 采用最差匹配策略,空闲列表的元素个数增加了。因为每次选择与请求大小最不接近的块进行分配,因此大概率是分割已有的大块空闲空间,因此空闲列表元素个数一般不会减少,会产生更多碎片 3. 不用 阅读全文
posted @ 2023-03-22 13:36 穿过雾的阴霾 阅读(20) 评论(0) 推荐(0) 编辑
摘要:思路 因为找的是字典序升序的下一个排列,因此要尽量保证前面不动,我们从后往前考虑 从后往前找到第一个非降序的位置,然后把这个位置的数字和最小的比它大的数字交换,最后从该位置后整理为升序 这样保证了值变大,且增大的最少 从数组末尾往前找,找到 第一个 位置 j,使得 nums[j] < nums[j 阅读全文
posted @ 2023-03-22 10:57 穿过雾的阴霾 阅读(12) 评论(0) 推荐(0) 编辑
摘要:class Solution { public: ListNode* deleteDuplication(ListNode* head) { ListNode* dummy=new ListNode(1),*tail=dummy; dummy->next=NULL; for(auto i=head, 阅读全文
posted @ 2023-03-21 14:44 穿过雾的阴霾 阅读(9) 评论(0) 推荐(0) 编辑
摘要:将下一个节点的值复制到当前节点,然后将下一个节点删除 class Solution { public: void deleteNode(ListNode* node) { node->val=node->next->val; auto p=node->next; node->next=node->n 阅读全文
posted @ 2023-03-21 13:51 穿过雾的阴霾 阅读(39) 评论(0) 推荐(0) 编辑
摘要:class Solution { public: double Power(double base, int e) { typedef long long LL; bool flag=false; if(e<0) flag=true; double res=1;//存储base的2的倍数次幂 //计 阅读全文
posted @ 2023-03-20 10:16 穿过雾的阴霾 阅读(20) 评论(0) 推荐(0) 编辑
摘要:class Solution { public: vector<string> res; void dfs(int l,int r,int n,string str) { if(r==n&&l==n)//如果左右括号都用完了,说明找到了一个答案 { res.push_back(str); retur 阅读全文
posted @ 2023-03-20 09:43 穿过雾的阴霾 阅读(5) 评论(0) 推荐(0) 编辑
摘要:class Solution { public: int NumberOf1(int n) { int res=0; for (int i = 0; i < 32; i ++ ) res+=(n>>i)&1; return res; } }; 阅读全文
posted @ 2023-03-19 11:20 穿过雾的阴霾 阅读(5) 评论(0) 推荐(0) 编辑
摘要:class Solution { public: ListNode* reverseKGroup(ListNode* head, int k) { ListNode* dummy=new ListNode(-1,head),*tail=dummy; while(tail) { ListNode* t 阅读全文
posted @ 2023-03-19 10:31 穿过雾的阴霾 阅读(14) 评论(0) 推荐(0) 编辑
摘要:#数学方法 class Solution { public: int maxProductAfterCutting(int n) { //特判一下n≤3的情况 if(n<=3) return 1*(n-1); int res=1; if(n%3==1) n-=4,res*=4;//拆出4 else 阅读全文
posted @ 2023-03-18 20:19 穿过雾的阴霾 阅读(17) 评论(0) 推荐(0) 编辑
摘要:class Solution { public: int cnt=0; int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, 1, 0, -1}; bool st[55][55]; void dfs(int x,int y,int k,int rows, int cols) 阅读全文
posted @ 2023-03-18 10:36 穿过雾的阴霾 阅读(13) 评论(0) 推荐(0) 编辑
摘要:/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nullptr) {} * ListNode(int x) : 阅读全文
posted @ 2023-03-18 09:57 穿过雾的阴霾 阅读(9) 评论(0) 推荐(0) 编辑
摘要:class Solution { public: int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, 1, 0, -1}; bool st[5][5]; bool dfs(vector<vector<char>>& matrix,int i,int j,int u,stri 阅读全文
posted @ 2023-03-17 20:43 穿过雾的阴霾 阅读(12) 评论(0) 推荐(0) 编辑
摘要:class Solution { public: struct cmp { bool operator()(ListNode *a,ListNode *b) { return a->val>b->val; } }; ListNode* mergeKLists(vector<ListNode*>& l 阅读全文
posted @ 2023-03-17 15:51 穿过雾的阴霾 阅读(10) 评论(0) 推荐(0) 编辑
摘要:class Solution { public: vector<vector<int>> fourSum(vector<int>& nums, int target) { vector<vector<int>> ans; long long tmp=target; sort(nums.begin() 阅读全文
posted @ 2023-03-16 21:48 穿过雾的阴霾 阅读(11) 评论(0) 推荐(0) 编辑
摘要:1. 运行程序无事发生 #include <sys/types.h> #include <unistd.h> #include <iostream> using namespace std; int main() { int *x = NULL; free(x); return 0; } 2. gd 阅读全文
posted @ 2023-03-16 20:03 穿过雾的阴霾 阅读(30) 评论(0) 推荐(0) 编辑
摘要:1. #include <sys/types.h> #include <unistd.h> #include <iostream> using namespace std; int main() { int x = 100; cout << x << endl; int pid = fork(); 阅读全文
posted @ 2023-03-16 19:32 穿过雾的阴霾 阅读(9) 评论(0) 推荐(0) 编辑
摘要:1. python3 ./lottery.py -s 1 -c python3 ./lottery.py -s 2 -c python3 ./lottery.py -s 3 -c 2. 估计压根不会运行,如此不平衡导致进程饿死 python3 ./lottery.py -l 10:1,10:100 阅读全文
posted @ 2023-03-16 14:43 穿过雾的阴霾 阅读(5) 评论(0) 推荐(0) 编辑
摘要:class Solution { public: int findMin(vector<int>& nums) { if(!nums.size()) return -1; int n=nums.size()-1; while(n>0&&nums[n]==nums[0]) n--;//倒序删除第二段元 阅读全文
posted @ 2023-03-15 14:16 穿过雾的阴霾 阅读(14) 评论(0) 推荐(0) 编辑
摘要:class Solution { public: int threeSumClosest(vector<int>& nums, int target) { int n=nums.size(); pair<int,int> res(INT_MAX,0);//分别存储差值,和 sort(nums.beg 阅读全文
posted @ 2023-03-15 11:38 穿过雾的阴霾 阅读(13) 评论(0) 推荐(0) 编辑
摘要:无语,就是两个栈倒来倒去 class MyQueue { public: stack<int> st; stack<int> tmp; /** Initialize your data structure here. */ MyQueue() { } /** Push element x to th 阅读全文
posted @ 2023-03-14 15:36 穿过雾的阴霾 阅读(7) 评论(0) 推荐(0) 编辑
摘要:class Solution { public: vector<vector<int>> threeSum(vector<int>& nums) { vector<vector<int>> res; sort(nums.begin(),nums.end()); int n=nums.size(); 阅读全文
posted @ 2023-03-14 15:11 穿过雾的阴霾 阅读(9) 评论(0) 推荐(0) 编辑
摘要:class Solution { public: string replaceSpaces(string &str) { int len=0; for(auto c:str) { if(c==' ') len+=3; else len++; } int i=str.size()-1,j=len-1; 阅读全文
posted @ 2023-03-13 10:53 穿过雾的阴霾 阅读(13) 评论(0) 推荐(0) 编辑
摘要:class Solution { public: bool searchArray(vector<vector<int>> array, int target) { if(array.empty()||array[0].empty()) return false; int i=0,j=array[0 阅读全文
posted @ 2023-03-13 10:51 穿过雾的阴霾 阅读(10) 评论(0) 推荐(0) 编辑
摘要:class Solution { public: int duplicateInArray(vector<int>& nums) { int l=1,r=nums.size()-1;//注意r是n-1 while(l<r) { int cnt=0;//记录≤mid的个数 int mid=l+r>>1 阅读全文
posted @ 2023-03-13 10:51 穿过雾的阴霾 阅读(16) 评论(0) 推荐(0) 编辑
摘要:class Solution { public: int duplicateInArray(vector<int>& nums) { int n=nums.size(); for (int i = 0; i < n; i ++ ) if(nums[i]<0||nums[i]>=n) //防止遇到重复 阅读全文
posted @ 2023-03-13 10:50 穿过雾的阴霾 阅读(15) 评论(0) 推荐(0) 编辑
摘要:/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), r 阅读全文
posted @ 2023-03-13 10:49 穿过雾的阴霾 阅读(11) 评论(0) 推荐(0) 编辑
摘要:/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode *father; * TreeNode(int x) : v 阅读全文
posted @ 2023-03-13 10:48 穿过雾的阴霾 阅读(14) 评论(0) 推荐(0) 编辑
摘要:class Solution { public: int reverse(int x) { long long res=0; while(x) { int t=x%10; x/=10; res=res*10+t; } if(res<INT_MIN||res>INT_MAX) return 0; re 阅读全文
posted @ 2023-03-13 09:19 穿过雾的阴霾 阅读(10) 评论(0) 推荐(0) 编辑
摘要:1.限制作业长度并关闭IO python3 mlfq.py -j 2 -n 2 -c python3 mlfq.py --jlist 0,10,0:0,5,0 -n 2 -c 2.实现书上示例 python3 mlfq.py -l 0,200,0 -c python3 mlfq.py -l 0,20 阅读全文
posted @ 2023-03-12 16:27 穿过雾的阴霾 阅读(34) 评论(0) 推荐(0) 编辑
摘要:一二三章实验环境配置见:https://blog.csdn.net/plus_re/article/details/60761467 第四章加入了deit等指令,需要添加一些exe文件:https://blog.csdn.net/Ghost_jzy/article/details/104572876 阅读全文
posted @ 2023-03-12 16:24 穿过雾的阴霾 阅读(73) 评论(0) 推荐(0) 编辑
摘要:#第一章 基础知识 ###知识点 总线宽度:该总线有N个根线,则可以说这个总线的宽度为N 主板:主板上有一些重要器件,器件通过总线连接。这些器件有CPU,存储器,外围芯片组,拓展插槽等。拓展插槽一般插有RAM内存条和各类接口卡 接口卡:CPU通过总线向接口卡发送命令,接口卡根据CPU命令对外设进行控 阅读全文
posted @ 2023-03-12 16:22 穿过雾的阴霾 阅读(111) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示