摘要:
#include <iostream> #include <algorithm> using namespace std; int A[100], T[100]; int n, cnt; void solve(int root) {//结点 if (root > n) return ; solve( 阅读全文
#include <iostream> #include <algorithm> using namespace std; int A[100], T[100]; int n, cnt; void solve(int root) {//结点 if (root > n) return ; solve( 阅读全文
posted @ 2022-02-18 16:56
帝宝单推人!
阅读(37)
评论(0)
推荐(0)

利用递归将每一个结点看成根结点 #include <iostream> using namespace std; int pre[10], in[10];//先序和中序 int post[10];//后序 void solve(int prel, int inl, int postl, int n)
邻接矩阵 #include <iostream> using namespace std; //定义边 typedef struct Enode *PtrlEnode; struct Enode { int V1, V2; //有向边<V1,V2> int weight;//权重 }; typede
没有进行路径压缩 #include <iostream> #include <vector> using namespace std; typedef int Elemtype; #define Maxsize 100 typedef struct { Elemtype data; int pare
##优先队列 特殊的“队列”,取出元素的顺序是依照元素的优先权的大小,而不是先进先出。 优先队列会进行自动排序 #include<iostream> #include<queue> using namespace std; int main() { priority_queue <int> q;//
#include<iostream> using namespace std; struct node { int val; struct node *left; struct node *right; }; //LL旋转 node *singleLeftRotation(node *root) {
BinTree Insert( BinTree BST, ElementType X ) { if( !BST ){ /* 若原树为空,生成并返回一个结点的二叉搜索树 */ BST = (BinTree)malloc(sizeof(struct TNode)); BST->Data = X; BST
#include <iostream> #include <cstring> #include <iomanip>//设置域宽头文件 using namespace std; typedef struct Link *List; typedef struct Link { string name;
正整数分解,使得乘积最大 需要把一个正整数分为多个3相加最后一个数小于等于4时停止 #include <iostream> using namespace std; typedef long long ll; ll a; ll fast_pow(ll m, ll h) {//快速幂 ll sum =
二进制枚举点这里 #include <bits/stdc++.h> using namespace std; typedef long long ll; int N[10010], val1[10010], val2[10010]; int n, r, idx1, idx2; bool check(
浙公网安备 33010602011771号