![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构
文章平均质量分 92
十月夜未央
路漫漫其修远兮,吾将上下而求索。
展开
-
6-1 Shortest Path [2]
Write a program to find the weighted shortest distances from any vertex to a given source vertex in a digraph. It is guaranteed that all the weights are positive. Format of functions: void ShortestDis...原创 2019-12-04 19:42:52 · 361 阅读 · 0 评论 -
实习四 6-1 Two Stacks In One Array (20 分)
**6-1 Two Stacks In One Array两个栈在一个排列里 (20 分)** Write routines to implement(实现) two stacks using only one array. Your stack routines should not declare(宣告、表明) an overflow(溢出) unless every slot in the...原创 2019-10-09 19:52:37 · 477 阅读 · 0 评论 -
实习四 6-2 另类堆栈 (15 分)
6-2 另类堆栈 (15 分) 在栈的顺序存储实现中,另有一种方法是将Top定义为栈顶的上一个位置。请编写程序实现这种定义下堆栈的入栈、出栈操作。如何判断堆栈为空或者满? 函数接口定义: bool Push( Stack S, ElementType X ); ElementType Pop( Stack S ); 其中Stack结构定义如下: typedef int Position; typ...原创 2019-10-09 20:01:50 · 2181 阅读 · 0 评论 -
实习四 7-1 汉诺塔的非递归实现 (25 分)
7-1 汉诺塔的非递归实现 (25 分) 借助堆栈以非递归(循环)方式求解汉诺塔的问题(n, a, b, c),即将N个盘子从起始柱(标记为“a”)通过借助柱(标记为“b”)移动到目标柱(标记为“c”),并保证每个移动符合汉诺塔问题的要求。 输入格式: 输入为一个正整数N,即起始柱上的盘数。 输出格式: 每个操作(移动)占一行,按柱1 -> 柱2的格式输出。 输入样例: 3 输出样例: a...原创 2019-10-09 20:40:21 · 1203 阅读 · 0 评论