随笔分类 -  数据结构

链表实现冒泡排序
摘要:#include #include #include #include #include #include #include #include #include #include #define NSY "Not sure yet.\n" #define IDG "In different gangs.\n" #define ITSG "In the same gang.\n... 阅读全文

posted @ 2016-12-06 15:35 acmtime 阅读(3165) 评论(0) 推荐(0)

用邻接表实现某个点入度和出度
摘要:#include #include #include using namespace std; typedef struct node{//邻接表上的节点 int n; struct node * next; } GNode; typedef struct graph{//图的整个结构 int cn;//顶点个数 int bn;//边的个数 G... 阅读全文

posted @ 2016-11-27 11:39 acmtime 阅读(2815) 评论(0) 推荐(0)

02-线性结构2 一元多项式的乘法与加法运算
摘要:设计函数分别求两个一元多项式的乘积与和。 输入格式: 输入分2行,每行分别先给出多项式非零项的个数,再以指数递降方式输入一个多项式非零项系数和指数(绝对值均为不超过1000的整数)。数字间以空格分隔。 输出格式: 输出分2行,分别以指数递降方式输出乘积多项式以及和多项式非零项的系数和指数。数字间以空 阅读全文

posted @ 2016-10-15 22:21 acmtime 阅读(444) 评论(0) 推荐(0)

使用一个数组实现两个堆栈
摘要:/* 使用一个数组实现两个堆栈,要求最大的利用数组空间,使数组只要有空间入栈操作就可以 成功 分析:一种比较聪明的方法是使这两个栈分别从数组 两头开始向中间生长,当两个栈的栈顶指针相遇,表示栈满 */ #include #include using namespace std; const int MaxSize = 1e3; struct Dstack{ int Data[Max... 阅读全文

posted @ 2016-09-28 19:43 acmtime 阅读(2083) 评论(0) 推荐(0)

01-复杂度2 Maximum Subsequence Sum (25分)
摘要:Given a sequence of KKK integers { N1N_1N​1​​, N2N_2N​2​​, ..., NKN_KN​K​​ }. A continuous subsequence is defined to be { NiN_iN​i​​, Ni+1N_{i+1}N​i+1 阅读全文

posted @ 2016-09-25 12:02 acmtime 阅读(879) 评论(0) 推荐(0)

导航