此题和之前的剑指offer32-I、II.从上到下打印二叉树大致相同在BFS的基础上只是添加了一个重排序的过程。具体代码如下: 1 /** 2 * Definition for a binary tree node. 3 * struct TreeNode { 4 * int val; 5 * st ...
分类:
其他好文 时间:
2020-07-18 11:18:07
阅读次数:
58
线段树是学不明白了…… 部分指针用法 对于这段代码, struct Node{ int a, b, c; }YJH[100], x; Node *p = YJH, *q = &x; 以下代码在使用过程中是等价的: cout << x.a << endl; cout << q->a << endl; ...
分类:
其他好文 时间:
2020-07-18 00:55:56
阅读次数:
106
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int N=5e5+10; struct node{ int cnt; node * nxt[27]; node * fail; vector<node ...
分类:
其他好文 时间:
2020-07-18 00:44:51
阅读次数:
57
采用分治思想 #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; double a,b,c,d; double f(double x) { return ...
分类:
其他好文 时间:
2020-07-17 13:39:43
阅读次数:
71
题目描述 给出一个集合和一个数m。 集合里面有n个质数。 请你求出从 1 到 m 的所有数中,至少能被集合中的一个数整除的数的个数。 输入描述: 第一行两个正整数 n 和 m 。第二行n个正整数,分别为集合中的质数。 输出描述: 输出一个整数,表示符合要求的正整数的个数。 示例1 输入 复制 3 3 ...
分类:
其他好文 时间:
2020-07-16 11:50:38
阅读次数:
68
1.区间求和 2.区间取模 3.单点修改 线段树,区间取模加一个剪枝:区间最大值<mod,不修改。其他单点取模 #include <bits/stdc++.h> using namespace std; #define debug printf("bug!!!\n"); typedef long l ...
分类:
其他好文 时间:
2020-07-16 11:50:06
阅读次数:
63
一个数最多能取8-9次根号。 #include <bits/stdc++.h> using namespace std; #define debug printf("bug!!!\n"); typedef long long ll; const int MAXN=1e5+10; const ll M ...
分类:
其他好文 时间:
2020-07-16 10:11:53
阅读次数:
74
顺序查找 算法思想 算法实现 算法优化 顺序查找的算法思想 顺序查找,又叫“线性查找”,通常用于线性表 从头到尾查 顺序查找的实现 typedef struct{ //查找表的数据结构(顺序表) ElemType *elem; //动态数组的基址 int TableLen; //表的长度 }SSTa ...
分类:
其他好文 时间:
2020-07-15 23:37:04
阅读次数:
97
#include<stdio.h> #define maxsize 6 typedef int ElemType; typedef struct { ElemType data; int cur; } component; //1.创建备用链表 void reserverArr(component ...
分类:
其他好文 时间:
2020-07-15 01:21:11
阅读次数:
58
题目:创建一个链表。 程序分析:无。 实例: 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<malloc.h> 4 typedef struct LNode{ 5 int data; 6 struct LNode *next; 7 }LNod ...
分类:
其他好文 时间:
2020-07-14 13:25:56
阅读次数:
58