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

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

问题描述

在我看来,预遍历和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天全站免登陆