摘要: 数据结构实验之图论七:驴友计划 Time Limit: 1000 ms Memory Limit: 65536 KiB Submit Statistic Discuss Problem Description 做为一个资深驴友,小新有一张珍藏的自驾游线路图,图上详细的标注了全国各个城市之间的高速公路 阅读全文
posted @ 2018-07-29 11:43 Gaojinman 阅读(220) 评论(0) 推荐(0)
摘要: 图结构练习——最短路径 Time Limit: 1000 ms Memory Limit: 65536 KiB Submit Statistic Discuss Problem Description 给定一个带权无向图,求节点1到节点n的最短路径。 Input 输入包含多组数据,格式如下。 第一行 阅读全文
posted @ 2018-07-29 11:41 Gaojinman 阅读(161) 评论(0) 推荐(0)
摘要: void DFS( int x ) { visit[x] = true; for(int i=0; i Q; void BFS ( int s ) { Visit[s] = true; Q.push(s); while( !Q.empty() ) { int V = Q.front(); Q.pop(); ... 阅读全文
posted @ 2018-07-25 10:13 Gaojinman 阅读(119) 评论(0) 推荐(0)
摘要: 1 #include 2 3 using namespace std; 4 5 typedef int ElementType; 6 7 8 /*插入排序*/ /*时间复杂度O(N²)*/ 9 void InsertionSort ( ElementType *A, int N ) 10 { 11 int j, P; 12 13 ... 阅读全文
posted @ 2018-07-21 16:10 Gaojinman 阅读(236) 评论(0) 推荐(0)
摘要: C++有栈和队列的函数 #include <queue> #include <stack> queue < int > Q; //定义int类型为例 stack < int > S; Stack(堆栈) 是一个容器类的改编,提供了堆栈的全部功能,——也就是说实现了一个先进后出(FILO)的数据结构。 阅读全文
posted @ 2018-07-19 22:06 Gaojinman 阅读(145) 评论(0) 推荐(0)
摘要: #include #include struct node { int data; struct node *next; }; struct node *head, *tail, *p, *q, *r; void SequenceCreate () /*顺序建立链表*/ { /*建立一个空结点*/ head = ( ... 阅读全文
posted @ 2018-07-19 16:43 Gaojinman 阅读(84) 评论(0) 推荐(0)
摘要: 从第一次在CB上运行处 Hello World开始,哈哈哈哈,便开始各种幻想,哈哈哈哈,想着这就入门了,哈哈哈哈,我果然是个天才,哈哈哈哈。 后来啊,if-else语句,for 语句,while语句,等等等等,再到数组函数指针,我以为就只有这些东西,嗯嗯哈哈哈,精通。 excuse me???精什么 阅读全文
posted @ 2018-06-06 10:14 Gaojinman 阅读(330) 评论(0) 推荐(0)
摘要: 数据结构实验之二叉树八:(中序后序)求二叉树的深度 Time Limit: 1000 ms Memory Limit: 65536 KiB Submit Statistic Discuss Problem Description 已知一颗二叉树的中序遍历序列和后序遍历序列,求二叉树的深度。 已知一颗 阅读全文
posted @ 2018-05-30 19:56 Gaojinman 阅读(158) 评论(0) 推荐(0)
摘要: 数据结构实验之二叉树七:叶子问题 Time Limit: 1000 ms Memory Limit: 65536 KiB Submit Statistic Discuss Problem Description 已知一个按先序输入的字符序列,如abd,,eg,,,cf,,,(其中,表示空结点)。请建 阅读全文
posted @ 2018-05-30 19:55 Gaojinman 阅读(176) 评论(0) 推荐(0)
摘要: 数据结构实验之二叉树六:哈夫曼编码 Time Limit: 1000 ms Memory Limit: 65536 KiB Submit Statistic Discuss Problem Description 字符的编码方式有多种,除了大家熟悉的ASCII编码,哈夫曼编码(Huffman Cod 阅读全文
posted @ 2018-05-30 19:54 Gaojinman 阅读(213) 评论(0) 推荐(0)