To illustrate the radix sort algorithm we will sort the sequence S0 = {32, 100, 11, 554, 626, 122, 87, 963, 265, 108, 9}. We start by distributing ele ...
分类:
其他好文 时间:
2020-05-01 00:45:46
阅读次数:
56
最近工作中讨论到了Raft协议相关的一些问题,正好之前读过多次Raft协议的那paper,所以趁着讨论做一次总结整理。 我会将Raft协议拆成四个部分去总结: 算法基础 选举和日志复制 安全性 节点变更 这是第一篇:《解读Raft(一 算法基础)》 什么是RAFT 分布式系统除了提升整个体统的性能外 ...
分类:
其他好文 时间:
2020-04-30 18:59:10
阅读次数:
107
Description Write an algorithm to determine if a number n is "happy". A happy number is a number defined by the following process: Starting with any p ...
分类:
移动开发 时间:
2020-04-30 13:32:04
阅读次数:
91
1 #include "stdafx.h" 2 #include <algorithm> 3 #include <opencv2/core/core.hpp> 4 #include <opencv2/highgui/highgui.hpp> 5 #include <opencv2/imgproc/i ...
分类:
其他好文 时间:
2020-04-30 12:03:26
阅读次数:
129
题目如下: 思路: 1.建立一个数组存储26个字母出现的次数 注意数组大小!!! 小写的a-z ascll码为 97-122 大写的A-Z ascll 码为 65-90 所以数组的大小最好>=122 2.注意1和0不是素数 a['b'] 不要以字母的角度看待 要以ascll码看待带单引号的字母 代码 ...
分类:
其他好文 时间:
2020-04-30 12:00:31
阅读次数:
82
1,棋盘问题:poj1321 思路:显然,是一个深度搜索问题,对列进行标记一下,题中显示要同一行,同一列不能有两个,那么标记之后,就从下一行开始搜索,然后就一直递归下去; code: 1 #include<cstdio> 2 #include<algorithm> 3 #include<iostre ...
分类:
其他好文 时间:
2020-04-29 23:36:00
阅读次数:
63
题意:在一个二维平面上 有三种操作 1.添加一个点 2.删去一个点 3.询问严格在(x, y)右上的点 先取最左 然后最低的 题解:先把x离散化 然后用线段树维护横坐标为x的最大值 同样把每个x开一个set 就可以处理添加和删除操作了 询问(x, y) 就是在横坐标大于x的区域 求第一个最大值大于y ...
分类:
其他好文 时间:
2020-04-29 21:45:20
阅读次数:
48
https://github.com/hotwater99/practice_datastructure_and_algorithm.git《数据结构与算法分析——C语言描述》机械工业出版社,原书第2版,第7章N=100N=1000N=10000N=100000插入排序 insertion sort... ...
分类:
编程语言 时间:
2020-04-29 20:20:05
阅读次数:
98
降低圈复杂度 用functional的方式降低圈复杂度 用stl algorithm代替for loop https://blog.csdn.net/YyoulingL/article/details/84515924 "降低圈复杂度" https://zhuanlan.zhihu.com/p/29 ...
分类:
其他好文 时间:
2020-04-29 20:08:36
阅读次数:
71
deque即数组形式的双端队列。 #include<iostream> #include<deque> #include<algorithm> using namespace std; int main() { //构造 deque<int> d = { 2,6,8 }; //遍历 for (deq ...
分类:
其他好文 时间:
2020-04-29 10:40:23
阅读次数:
61