07 2019 档案
摘要:#include <iostream> #include <cstring> #include <queue> using namespace std; typedef struct node tree; struct node { char data; struct node *left; str
阅读全文
摘要:Your job is, given a positive number N, determine if it is a multiple of eleven. Input The input is a file such that each line contains a positive num
阅读全文
摘要:自学于《啊哈!算法》 #include <iostream> #include <cstdio> #include <algorithm> #include <cstdlib> const int maxn=10000000; using namespace std; int a[100005];
阅读全文
摘要:Input 第一行输入整数n(1<=n<=50000),表示整数序列中的数据元素个数; 第二行依次输入n个整数,对应顺序表中存放的每个数据元素值。 Output 一行输出两个整数,之间以空格间隔输出: 第一个整数为所求的最大子段和; 第二个整数为用分治递归法求解最大子段和时,递归函数被调用的总次数。
阅读全文
摘要:数据结构实验之二叉树八:(中序后序)求二叉树的深度 Problem Description 已知一颗二叉树的中序遍历序列和后序遍历序列,求二叉树的深度。 Input 输入数据有多组,输入T,代表有T组数据。每组数据包括两个长度小于50的字符串,第一个字符串表示二叉树的中序遍历,第二个表示二叉树的后序
阅读全文
摘要:数据结构实验之二叉树四:(先序中序)还原二叉树 Problem Description 给定一棵二叉树的先序遍历序列和中序遍历序列,要求计算该二叉树的高度。 Input 输入数据有多组,每组数据第一行输入1个正整数N(1 <= N <= 50)为树中结点总数,随后2行先后给出先序和中序遍历序列,均是
阅读全文
摘要:/*********************** 需要调用<windows.h> ***********************/ void gotoxy(int x,int y) { COORD pos; pos.X=x; pos.Y=y; HANDLE hOutput = GetStdHandl
阅读全文
摘要:数据结构实验之二叉树二:遍历二叉树 Time Limit: 1000 ms Memory Limit: 65536 KiB Problem Description 已知二叉树的一个按先序遍历输入的字符序列,如abc,de,g,f, (其中,表示空结点)。请建立二叉树并按中序和后序的方式遍历该二叉树。
阅读全文

浙公网安备 33010602011771号