赵大寳

鶸鸡程序员,新世纪农民工

Getting started To use clangd, you need: clangd installed a plugin for your editor to tell clangd how your project is built Installing clangd # You’ll want a recent version of clangd. The current rele…

Read more »

https://github.com/tensorflow/tfx-bsl/blob/master/third_party/arrow/util/config.h https://github.com/pixie-io/pixie/blob/62d4f0e0b5/bazel/external/arrow.BUILD https://github.com/google/struct2tensor/b…

Read more »

If on Linux you can install system dependencies to save building them: fbthrift 1 2 3 4 5 6 7 8 9 10 11 # Clone the repo wget https://apache.cs.utah.edu/thrift/0.12.0/thrift-0.12.0.tar.gz tar -xvf thr…

Read more »

explicit用来防止由构造函数定义的隐式转换。

要明白它的作用,首先要了解隐式转换:可以用单个实参来调用的构造函数定义了从形参类型到该类类型的一个隐式转换。

例如:

1
2
3
4
5
6
7
8
9
10
class things
{
public:
things(const std::string&name =""):
m_name(name),height(0),weight(10){}
int CompareTo(const things & other);
std::string m_name;
int height;
int weight;
};
Read more »

DFS 找环模板 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 # include <iostream> # include <vector> u…

Read more »

prometheus pushgateway收集数据: 服务端配置 1 2 docker pull prom/pushgateway docker run -d -p 9091:9091 prom/pushgateway 客户端逻辑: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 3…

Read more »

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 struct KMP &#123; vector< int > next; // 失配时,模式串跳转位置 void build ( const string &pattern) &#123; int n = pattern. length (); next. resize (n…

Read more »

前面讲了Bazel的基本本地使用,但是我们知道,Bazel最重要的是支持缓存和分布式(远程执行),那么这一节主要就是讲如何让bazel使用缓存。 要能够缓存Bazel每个action的输出,我们就要一个server来实现remote cache,用于存储action的输出。这些输出实际上是一堆文件恶化对应的hash值。总体来说,我们需要满足三个前提: 设置一个server作为cache backe…

Read more »

53. 最大子序和 给定一个整数数组 nums ,找到一个具有最大和的连续子数组(子数组最少包含一个元素),返回其最大和。 示例 1: 1 2 3 输入:nums = [-2,1,-3,4,-1,2,1,-5,4] 输出:6 解释:连续子数组 [4,-1,2,1] 的和最大,为 6 。 示例 2: 1 2 输入:nums = [1] 输出:1 示例 3: 1 2 输入:nums = [0] 输出:…

Read more »

209. 长度最小的子数组 Difficulty: 中等 给定一个含有 n 个正整数的数组和一个正整数 target 。 找出该数组中满足其和 ≥ target 的长度最小的 连续子数组 [nums<sub style="display: inline;">l</sub>, nums<sub style="display: inline;">l+1</sub>, ..., nums<sub sty…

Read more »

1、标准二分查找的适用场景: 数组元素有序且不重复 我们以 “搜索一个数,如果存在,返回其索引,否则返回 -1” 为例,给出标准二分查找的模板: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 // 二分查找某个数 int binarySearch (vector< int > nums, int target) &#123; int left = 0 ;…

Read more »

简介 本文总结了Zookeeper C客户端库在Centos 7上的编译,使用的Zookeeper版本为3.4.13。 安装工具 安装cppunit和ant工具: yum install -y cppunit-devel yum install -y ant 编译 下载release版本的源码: wget https://github.com/apache/zookeeper/archive/re…

Read more »

前言 在众多背包问题中「01 背包问题」是最为核心的,因此我建议你先精读过 背包问题 第一讲 之后再阅读本文。 其中 01 背包的「一维空间优化」更是要重点掌握。 另外,我在文章结尾处列举了我所整理的关于背包问题的相关题目。 背包问题我会按照编排好的顺序进行讲解(每隔几天更新一篇,确保大家消化)。 你也先可以尝试做做,也欢迎你向我留言补充,你觉得与背包相关的 DP 类型题目 ~ 题目描述 有 $N…

Read more »

STL 就是所谓的标准模板库(Standard Template Library),这可能是C++程序员的一大利器。 总的来说,STL包括几个部分:容器,算法(泛型算法),迭代器三个主要部分(当然还包含仿函数,适配器等其他部分),下图说明了三个主要部分之间的关系( 网图,侵删 )。 STL三个主要部分的关系示意图 要是详细的总结,这肯定是一本类似于《C++ Primer》的大书。本篇文章主要是对于…

Read more »

背包问题是一类经典的动态规划问题,它非常灵活,需要仔细琢磨体会,本文先对背包问题的几种常见类型作一个总结,期望可以用一套框架解决背包问题。 不少同学对背包问题还处于朦胧状态,我特意录了一期视频 带你学透0-1背包问题! ,这里详细介绍了0-1背包的中dp数组的定义,初始化,递推公式,以及遍历顺序。相信结合本篇题解,会对你学习背包有所帮助。 本篇目录: 前序 01 背包 二维dp数组 01背包 一维…

Read more »

一些常见的动态内存错误: 1.对NULL指针解引用 2.对动态开辟空间进行越界访问 3.非动态开辟空间使用free进行释放 4.在使用free释放一块动态开辟的空间只释放了部分 5.一块空间多次释放 6.忘记释放—->内存泄露 什么是内存泄露?? 指由于疏忽或错误造成程序未能释放已经不再使用的内存的情况。内存泄漏并非指内存在物理上的消失,而是应用程序分配某段内存后,由于设计错误,失去了对该段内存的…

Read more »

动态规划算法模板: [bash] 1 2 3 4 5 6 7 8 9 10 11 12 result = [] void dynamic_programming (路径, 选择列表) &#123; // 1.通用初始化 vector< int > dp (容量 + 1 , base case1); // 2.边界初始化 dp[ 0 ][ 0 ][...] = base case2; // 3.状态…

Read more »

GPU 编译环境配置: 0、GPU驱动安装: 首先根据本机的显卡版本,确定nvidia显卡的驱动版本,然后根据驱动版本确定CUDA toolkit的版本。 \1. 查看显卡类型 1 2 $ lspci | grep -i nvidia 00:07.0 3D controller: NVIDIA Corporation TU104GL [Tesla T4] (rev a1) 显示所有的pci设备信息…

Read more »
0%