摘要: #include <bits/stdc++.h> void getNext(int m) { next[0] = -1; int i = 0, j = -1; while (i < m) { if (j == -1 || p[i] == p[j]) p[i] = j; else j = next[j 阅读全文
posted @ 2021-01-07 08:12 代码画师 阅读(52) 评论(0) 推荐(0)
摘要: A - 数据结构实验之图论一:基于邻接矩阵的广度优先搜索遍历 #include <iostream> #include <bits/stdc++.h> using namespace std; bool Map[105][105],vis[105]; void bfs(int k,int t) { 阅读全文
posted @ 2020-11-30 18:42 代码画师 阅读(74) 评论(0) 推荐(0)
摘要: #include <stdio.h> #include <stdlib.h> #include <string.h> int n; struct node { char data; node *left,*right; }; node *createTree1(char a[]) { node ro 阅读全文
posted @ 2020-11-22 22:58 代码画师 阅读(88) 评论(0) 推荐(0)
摘要: 层序遍历 void LevelOrderTraversal(BinTree BT) { Queue Q; BinTree T; if(!BT)return; Q=CreateQueue(); AddQ(Q,BT); while(!IsEmpty(Q)) { T=DeleteQ(Q); printf( 阅读全文
posted @ 2020-11-17 23:30 代码画师 阅读(62) 评论(0) 推荐(0)
摘要: void InorderTraversal( BinTree BT ) { if( BT ) { InorderTraversal( BT->Left ); /* 此处假设对BT结点的访问就是打印数据 / printf("%d ", BT->Data); / 假设数据为整型 */ InorderTr 阅读全文
posted @ 2020-11-17 22:10 代码画师 阅读(89) 评论(0) 推荐(0)
摘要: #include <stdio.h> #include <stdlib.h> #define MAXSIZE 105 int Binary_Search(int a[],int x,int left,int right) { if(left>right)return; int mid=(left+r 阅读全文
posted @ 2020-11-14 15:53 代码画师 阅读(72) 评论(0) 推荐(0)
摘要: strlen strcpy strcmp strcat strchr strstr int strlen(const char s) { int cnt=0; while(s[cnt]!='\0')cnt++; return cnt; } int strcmp(const char *s1,cons 阅读全文
posted @ 2020-10-28 22:20 代码画师 阅读(84) 评论(0) 推荐(0)
摘要: 万金生 计科1904 111 222 333 本文引用书籍: 《万金生》 #include <bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a >> b; cout << a + b; return 0; } 某个 阅读全文
posted @ 2020-09-21 23:25 代码画师 阅读(104) 评论(0) 推荐(0)
摘要: 1.求组合数函数(函数嵌套) 1 double cmn(int m,int n) // 定义cmn()函数求组合数 2 { 3 double res; 4 res=fac(m)/(fac(n)*fac(m-n)); // 调用fac()函数 5 return res; 6 } 7 double fa 阅读全文
posted @ 2020-08-14 15:50 代码画师 阅读(139) 评论(0) 推荐(0)
摘要: 1.四则运算:add substract multiply devide factorial ( 阶乘 ) 2. 阅读全文
posted @ 2020-08-14 15:44 代码画师 阅读(112) 评论(0) 推荐(0)