老师,什么时候出一个多叉树相关的内容

来源:2-1 红黑树与2-3树

_cp

2020-10-29 20:09:02

B树或者B+树这些

写回答

1回答

liuyubobobo

2020-10-29

在这个课程的最后,我会介绍 b 类树。


课程后续介绍的 trie,也是一中特殊的多叉树。



但是普通的多叉树的大多数方法,和二叉树完全一致,只不过每一个节点有多个孩子而已。


比如,Leetcode 上的这些问题,可能能帮助你:


n 叉树的前序遍历:https://leetcode-cn.com/problems/n-ary-tree-preorder-traversal/

n 叉树的后序遍历:https://leetcode-cn.com/problems/n-ary-tree-postorder-traversal/

n 叉树的层序遍历:https://leetcode-cn.com/problems/n-ary-tree-level-order-traversal/

n 叉树的深度:https://leetcode-cn.com/problems/maximum-depth-of-n-ary-tree/

n 叉树的 clone:https://leetcode-cn.com/problems/clone-n-ary-tree/

n 叉树的直径:https://leetcode-cn.com/problems/diameter-of-n-ary-tree/

序列化和反序列化 n 叉树:https://leetcode-cn.com/problems/serialize-and-deserialize-n-ary-tree/


另外,我们可以使用孩子兄弟法,将 n 叉树转换成二叉树,所以,如果不是特殊的 n 叉树,我们其实可以将其转化为 2 叉树处理:https://leetcode-cn.com/problems/encode-n-ary-tree-to-binary-tree/


继续加油!:)

0

算法与数据结构

波波老师5年集大成之作,算法与数据结构系统学习,考试、面试、竞赛通用

2636 学习 · 1090 问题

查看课程