上一页 1 2 3 4 5 6 7 ··· 10 下一页
摘要: 回溯算法可以当作是二叉树的结构进行分析,看在叶节点的位置是什么条件收获结果 每个抛进去的结果都是到叶子节点的路径 以leetcode17为例: 每一层遍历的是每一个号码对应的字符串,当号码全部遍历完成就可以返回结果,所以终止条件是(index==string.length());index是层数,s 阅读全文
posted @ 2023-09-26 17:02 iu本u 阅读(24) 评论(0) 推荐(0)
摘要: lambdas形式是: [](参数列表){操作} 【】里面是捕捉方式,即传参的方式 可以结合lambdas来增加筛选条件 vector<int>v{3,9,7,3,1}; auto it=std::find_if(v.begin(),v.end(),[](int value){return valu 阅读全文
posted @ 2023-09-25 19:21 iu本u 阅读(19) 评论(0) 推荐(0)
摘要: 函数指针可以将函数作为函数的参数,对函数的参数设置想要的操作 void PrintValue(int value){ std::cout<<value<<std::endl; } void ForEarch(const std::vector<int>& v,void(*funtion)(int)) 阅读全文
posted @ 2023-09-20 20:57 iu本u 阅读(10) 评论(0) 推荐(0)
摘要: #define LOG(x) std::cout<<"Hello"<<std::endl; 在项目属性的c++->Preprocesser(预处理)->Preprocesser Define中添加DR_MODULE,将configuration模式调为release #ifdef DR_MODULE 阅读全文
posted @ 2023-09-20 17:06 iu本u 阅读(131) 评论(0) 推荐(0)
摘要: 元组tuple;#include<tuple> std::tuple<std::string,istd::string,nt>sources; std::get<0>sources,std::get<1>sources; pair std::pair<std::string,std::string> 阅读全文
posted @ 2023-09-20 15:43 iu本u 阅读(19) 评论(0) 推荐(0)
摘要: 时间复杂度为O(n) //维护这个堆 void heapify(vector<int>& nums,int n,int i){ int largest=i;//假设为父节点 int lson=i*2+1; int rson=i*2+2; //找到最大值 if(lson<n&&nums[lson]>n 阅读全文
posted @ 2023-09-19 15:49 iu本u 阅读(13) 评论(0) 推荐(0)
摘要: 分析: 它是有n个节点,n-1条边 所以两个节点连接的边只有一条,那么要么是可以从这条边的起点开始能够到达0,要么是不能,不会有回路的情况 对于数据结构使用哈希表值为vector容器 int bfs(vector<vector<int>>& connections){ unordered_map<i 阅读全文
posted @ 2023-09-15 14:56 iu本u 阅读(18) 评论(0) 推荐(0)
摘要: 是在运行时将文件连接进项目 将dll.lib文件复制至Debug的可执行文件里面;将linker中的input额外依赖改成这个dll.lib文件的名字 阅读全文
posted @ 2023-09-13 20:06 iu本u 阅读(22) 评论(0) 推荐(0)
摘要: 静态连接发生再编译时 第一步要下载相应依赖的文件夹(GLFW) 将依赖的头文件库(include)和图书馆(lib-vcxxx)复制粘贴至项目所在的依赖文件夹位置; Dependencies文件夹创建在项目的解决方案同一级 更改项目属性 在c++的general中的additional includ 阅读全文
posted @ 2023-09-13 20:03 iu本u 阅读(35) 评论(0) 推荐(0)
摘要: 深度优先搜索 vector<bool>vis; int num=0; void dfs(vector<vector<int>>& isConnected,int x){ vis[x]=true; for(int i=0;i<isConnected[x].size();i++){ if(!vis[i] 阅读全文
posted @ 2023-09-13 12:47 iu本u 阅读(8) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 ··· 10 下一页