
数据结构
饮酒在风里
这个作者很懒,什么都没留下…
展开
-
PAT甲级L2-004 这是二叉搜索树吗? (25 分)(天梯赛备战)
#include <iostream>#include <vector>using namespace std;struct node{ int data; node *left,*right;};void insert(node* &root,int data)//生成二叉搜索树{ if(root==NULL) ...原创 2019-03-01 16:28:10 · 737 阅读 · 0 评论 -
堆-树 Middle Number TOJ3515
#include <iostream>using namespace std;#define N 1000struct heap{ int da[N],size; void init() { size=0; } void insert(int v,int id) { da[++size]=v; int tm=size; while(tm>...原创 2018-09-29 18:48:53 · 213 阅读 · 0 评论 -
TOJ 1036 火车进站问题(栈 c++ )
There is a famous railway station in PopPush City. Country there is incredibly hilly. The station was built in last century. Unfortunately, funds were extremely limited that time. It was possible to e...原创 2018-09-27 17:17:27 · 2241 阅读 · 0 评论 -
栈的基本操作 c++
#define MAXSIZE 1000struct stack{ int data[MAXSIZE]; //存储数据的数组 int top; //栈顶}bool empty(stack &s){ return s.top==0; //判断栈是否为空}bool full(stack &s){ return ...原创 2018-09-26 22:15:08 · 1138 阅读 · 0 评论 -
士兵队列训练问题 (队列 c++)
士兵队列训练问题Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 12321Accepted Submission(s): 5441Problem Description某部队进行新兵队列训练,将新兵从一开始按顺序依...原创 2018-09-25 21:26:50 · 3104 阅读 · 1 评论 -
数据结构 顺序队列 循环队列 基本操作
顺序队列基本操作:#define MAXSIZE 1000struct queue{ int front ,rear;//表示头指针和 尾指针 int data[MAXSIZE]; //存储数据的数组}void Initqueue(queue &q){ //初始化队列 q.front=0; q.rear;}bool Empty(queue &q...原创 2018-09-24 20:50:45 · 569 阅读 · 0 评论 -
大数加法-大数减法模板(高精度)
高精度加法#include <iostream>#include <cstring>#include <cstdio>#include <queue>#include <cmath>#include <algorithm>#include <vector>using namespace std;...原创 2019-09-13 13:47:32 · 183 阅读 · 0 评论 -
堆排序&&模拟堆排序
838. 堆排序输入一个长度为n的整数数列,从小到大输出前m小的数。输入格式第一行包含整数n和m。第二行包含n个整数,表示整数数列。输出格式共一行,包含m个整数,表示整数数列中前m小的数。数据范围1≤m≤n≤1051≤m≤n≤105,1≤数列中元素≤1091≤数列中元素≤109输入样例:5 34 5 1 3 2输出样例:1 2 3#i...原创 2019-09-19 21:43:20 · 231 阅读 · 0 评论