学习笔记
学习
hlhso_szh
这个作者很懒,什么都没留下…
展开
-
高级数据结构c++
树状数组 动态查询前缀和 vector<int>bits; //放树状数组 int N; //原数组的大小+1表示树状数组的大小,为什么要+1呢,因为树状数组多了一个前0个数的和 int query(int x) { //查询前缀和 int res = 0; for (; x; x -= x & -x) res += bit[x]; ...原创 2020-01-15 00:24:43 · 168 阅读 · 0 评论 -
c++多线程的总结
头文件 #include <thread> // 多线程 #include <atomic> // 原子量 #include <mutex> // 互斥锁 #include <condition_variable> // 条件变量 #include <future> // 线程结果交付 #include <chrono> //...转载 2019-12-17 22:22:20 · 204 阅读 · 0 评论 -
造轮子。。
一些复杂的数据结构模板 1树 //node.h #pragma once #include<iostream> using namespace std; class Node { public: Node() { data = 0; index = 0; plChild = nullptr; prChild = nullptr; pParent = nullpt...原创 2019-12-16 00:03:00 · 91 阅读 · 0 评论 -
leetcode,解数独算法
leetcode,解数独算法 这是题目 这是我的解法,用位运算先把已有的数存入row、col、mat,再用深度优先遍历慢慢推算剩下的,时间复杂度大约O(9^3),主要思想就是依次看每个空格能填什么数。 class Solution { public: int row[9]={0}; int col[9]={0}; int mat[9]={0}; bool dfs(...原创 2019-11-30 15:22:45 · 199 阅读 · 0 评论 -
tuple与bitset
c++primer相关 tuple——一种快速且随意的数据结构 在定义某种物品所有信息的时候特别好用,比如书籍,含有版号书名售价销量页数等信息,就可以用tuple定义。 可以将tuple结构做为参数或者返回值 bitset——二进制类型的array 当数组内的数据类型是二进制时使用。 可以用unsigned和string来进行初始化,如果没超出容量,则剩余高位置零,超出的话就将超出部分丢掉。 常...原创 2019-11-24 21:17:31 · 165 阅读 · 0 评论