随笔分类 - 图论
摘要:拓扑排序模板: 例题: Sorting It All Out 题目描述 An ascending sorted sequence of distinct values is one in which some form of a less-than operator is used to order
阅读全文
摘要:遍历即将树的所有结点访问且仅访问一次。 按照根节点位置的不同分为前序遍历,中序遍历,后序遍历。 一:前序遍历 1. 访问根结点; 2. 遍历左子树; 3. 遍历右子树。 二:中序遍历 1. 遍历左子树; 2. 访问根结点; 3. 遍历右子树。 三:后续遍历 1. 遍历左子树; 2. 遍历右子树; 3
阅读全文