摘要: #include <iostream> #include <cstring> #include <queue> using namespace std; typedef struct node tree; struct node { char data; struct node *left; str 阅读全文
posted @ 2019-07-28 21:20 Voca 阅读(23) 评论(0) 推荐(0)
摘要: 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 阅读全文
posted @ 2019-07-26 15:56 Voca 阅读(29) 评论(0) 推荐(0)
摘要: C++ STL 栈和队列详解 阅读全文
posted @ 2019-07-25 10:36 Voca 阅读(11) 评论(0) 推荐(0)
摘要: 自学于《啊哈!算法》 #include <iostream> #include <cstdio> #include <algorithm> #include <cstdlib> const int maxn=10000000; using namespace std; int a[100005]; 阅读全文
posted @ 2019-07-23 16:34 Voca 阅读(39) 评论(0) 推荐(0)
摘要: Input 第一行输入整数n(1<=n<=50000),表示整数序列中的数据元素个数; 第二行依次输入n个整数,对应顺序表中存放的每个数据元素值。 Output 一行输出两个整数,之间以空格间隔输出: 第一个整数为所求的最大子段和; 第二个整数为用分治递归法求解最大子段和时,递归函数被调用的总次数。 阅读全文
posted @ 2019-07-22 15:58 Voca 阅读(52) 评论(0) 推荐(0)
摘要: 数据结构实验之二叉树八:(中序后序)求二叉树的深度 Problem Description 已知一颗二叉树的中序遍历序列和后序遍历序列,求二叉树的深度。 Input 输入数据有多组,输入T,代表有T组数据。每组数据包括两个长度小于50的字符串,第一个字符串表示二叉树的中序遍历,第二个表示二叉树的后序 阅读全文
posted @ 2019-07-17 23:54 Voca 阅读(34) 评论(0) 推荐(0)
摘要: 数据结构实验之二叉树四:(先序中序)还原二叉树 Problem Description 给定一棵二叉树的先序遍历序列和中序遍历序列,要求计算该二叉树的高度。 Input 输入数据有多组,每组数据第一行输入1个正整数N(1 <= N <= 50)为树中结点总数,随后2行先后给出先序和中序遍历序列,均是 阅读全文
posted @ 2019-07-17 23:50 Voca 阅读(34) 评论(0) 推荐(0)
摘要: /*********************** 需要调用<windows.h> ***********************/ void gotoxy(int x,int y) { COORD pos; pos.X=x; pos.Y=y; HANDLE hOutput = GetStdHandl 阅读全文
posted @ 2019-07-13 19:27 Voca 阅读(26) 评论(0) 推荐(0)
摘要: 数据结构实验之二叉树二:遍历二叉树 Time Limit: 1000 ms Memory Limit: 65536 KiB Problem Description 已知二叉树的一个按先序遍历输入的字符序列,如abc,de,g,f, (其中,表示空结点)。请建立二叉树并按中序和后序的方式遍历该二叉树。 阅读全文
posted @ 2019-07-09 17:05 Voca 阅读(18) 评论(0) 推荐(0)
摘要: 数据结构实验之链表六:有序链表的建立 Problem Description 输入N个无序的整数,建立一个有序链表,链表中的结点按照数值非降序排列,输出该有序链表。 Input 第一行输入整数个数N; 第二行输入N个无序的整数。 Output 依次输出有序链表的结点值。 Sample Input 6 阅读全文
posted @ 2019-06-29 19:23 Voca 阅读(44) 评论(0) 推荐(0)