二叉树上的预排序遍历与深度优先搜索相同吗? [英] Is Pre-Order traversal on a binary tree same as Depth First Search?

查看:12
本文介绍了二叉树上的预排序遍历与深度优先搜索相同吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我看来,前序遍历和 DFS 与我们以深度方式遍历到叶节点的两种情况相同.如果我错了,有人可以纠正我吗?

It seems to me like Pre-order traversal and DFS are same as in both the cases we traverse till the leaf node in a depth wise fashion. Could anyone please correct me if I am wrong?

提前致谢!

推荐答案

预购是 DFS 的一种.

Pre-order is one type of DFS.

深度优先遍历有前序、中序和后序三种.

There are three types of depth-first traversal: pre-order, in-order, and post-order.

查看此处了解更多信息.

这篇关于二叉树上的预排序遍历与深度优先搜索相同吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆