顺序遍历的大O,树的顺序遍历,后序,层级顺序 [英] Big O of pre order traversal, in order traversal ,post order, level order for tree

查看:88
本文介绍了顺序遍历的大O,树的顺序遍历,后序,层级顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请让我知道上面的大哦.

Please let me know the Big Oh of the above.

推荐答案

考虑执行这些遍历的算法的样子-您将使用什么数据结构(堆栈,队列,其他内容?)以及您需要执行多少次操作来处理树中的每个节点?您是否必须对树中的一个节点进行两次处理?

Think about how an algorithm executing these traversals would look like - what data structure would you use (stack, queue, something else?) and how many operations would you need to execute for processing each node in the tree? Would you ever have to process a node in the tree twice at all?

这篇关于顺序遍历的大O,树的顺序遍历,后序,层级顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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