01 2019 档案
摘要:#include<iostream> using namespace std; struct node { int data; node *next, *prior; }; class queue { private: node * front, *rear; public: queue(int e
阅读全文
摘要:所谓全源最短路径问题(All-Pairs Shortest Paths Problem),可以认为是单源最短路径问题的推广,即分别以每个顶点作为源顶点并求其至其它顶点的最短距离。 #include<iostream> #include<algorithm> #include<iomanip> usi
阅读全文
摘要:报错内容: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "tesserocr.pyx", line 2443, in tesserocr._tesserocr.image_to_text Ru
阅读全文
摘要:返回最小生成树的边权值之和。 prim算法核心思想就是贪心,与dijstra算法结构如出一辙。 代码和注释如下: #include<iostream> #include<vector> #include<iomanip>//用于格式化输出 #define maxn 1000//最大节点数 #defi
阅读全文
摘要:注释很详尽了: #include<iostream> #include<vector> #define maxn 1000//最大节点数 #define inf 1000000000//模拟距离无限大 int G[maxn][maxn];//邻接阵,用于比较时提取G[u][v] using name
阅读全文
摘要:给出代码: #include<iostream> #include<vector> #include<queue> #define maxn 1000 bool inq[maxn] = { false }; using namespace std; struct node { int adjvex;
阅读全文
摘要:用的是上一会STL创立的邻接表。 代码给出: #include<iostream> #include<vector> #define maxn 1000 bool vis[maxn] = { false }; using namespace std; struct node { int adjvex
阅读全文
摘要:a)没啥好说 b)创建一个名字为rfindchr()的函数,查找字符最后一次出现的位置。 mystring=input('Enter srting:') c=input('Enter char') #s是myatring的逆序 s=mystring[::-1] for i,j in enumerat
阅读全文
摘要:在此基础上稍作修改:https://www.cnblogs.com/kidney/p/7627145.html 使用了psutil模块查看运行时的硬件数据。 以下是第一次尝试的代码: import hashlib import json from time import time from urll
阅读全文
摘要:即是将素数标记,筛去已标记素数倍数的方法,来获取素数表,这样大大降低了时间复杂度。 #include<iostream> using namespace std; const int maxn = 1000;//表长 int prime[maxn], pNum = 0;//prime数组存放所有素数
阅读全文
摘要:#include<iostream> #include<cmath> using namespace std; //判断n是否为素数 bool isPrime(int n) { if (n <= 1)return false; int sqr = (int)sqrt(1.0*n); for (int
阅读全文
摘要:注:以栈为例,因为队列只要修改popit()函数处代码,和修改相关提示语句即可。 #Python的栈定义与计基本操作 #队列只是改下提示语句和popit()函数 stack=[] def pushit(): stack.append(input('输入新的元素并入栈:').strip()) #若是队
阅读全文
摘要:1)建堆操作时,需要向下调整操作。具体思路是这样的:总是将当前节点v与他的左右孩子比较。若孩子中存在权值比比V大的,就将最大的那个孩子节点与其双亲节点交换以达到上移的目的。交换完毕后继续以v为根节点比较第二轮(这是递归),经过若干轮后直到节点v的孩子节点权值都比v节点权值小,或者v节点无左右孩子时,
阅读全文
摘要:转载:https://www.cnblogs.com/jlf0103/p/9168093.html 类型代码: 计算机为数组分配一段连续的内存,从而支持对数组随机访问; 由于项的地址在编号上是连续的,数组某一项的地址可以通过将两个值相加得出,即将数组的基本地址和项的偏移地址相加。 数组的基本地址就是
阅读全文
摘要:说明: 使用serverSpeeder 服务进行锐速的启动,停止,以及重新加载配置等操作;各参数说明如下: service serverSpeeder start :启动锐速,加载加速模块;使用/serverspeeder/etc/config 文件中的配置作为模块加载时的初始化参数; servic
阅读全文
摘要:void change(bitnode *&t, int x, int y) { bitnode *temp = new bitnode; if (t==NULL)return//若是根节点为NULL,递归结束 temp = t->lchild; t->lchild = t->rchild; t->
阅读全文
摘要:三个文件,注释已经很清楚了: main.cpp #include"tree.h" int main(void) { bitt A; int n, v; cin >> n; for (int i = 0; i < n; i++) { cin >> v; A.insert(A.root, v); } c
阅读全文