简体   繁体   English

算法二叉树通过复杂度 O (n) 的 T 级生成路径

[英]Algorithm binary tree makes a path by level of T with complexity O (n)

Hey guys I have a doubt to resolve this issue, someone could help me?嘿伙计们,我有疑问要解决这个问题,有人可以帮助我吗?

A level path in a binary T tree visits all T nodes per level (first level 0 followed by levels 1, 2, 3...) where nodes of the same level are visited from left to right.二叉 T 树中的级别路径访问每个级别的所有 T 节点(第一个级别 0,然后是级别 1、2、3...),其中从左到右访问同一级别的节点。

Write an algorithm that receives as input a binary tree T and makes a path by level of T with complexity O (n), where n is the number of nodes of T.编写一个算法,接收二叉树 T 作为输入,并按 T 的级别创建一条路径,复杂度为 O(n),其中 n 是 T 的节点数。

Using pseudocode:)使用伪代码:)

Hey guys I have a doubt to resolve this issue, someone could help me?嘿伙计们,我有疑问要解决这个问题,有人可以帮助我吗?

A level path in a binary T tree visits all T nodes per level (first level 0 followed by levels 1, 2, 3...) where nodes of the same level are visited from left to right.二叉 T 树中的级别路径访问每个级别的所有 T 节点(第一个级别 0,然后是级别 1、2、3...),其中从左到右访问同一级别的节点。

Write an algorithm that receives as input a binary tree T and makes a path by level of T with complexity O (n), where n is the number of nodes of T.编写一个算法,接收二叉树 T 作为输入,并按 T 的级别创建一条路径,复杂度为 O(n),其中 n 是 T 的节点数。

Using pseudocode:)使用伪代码:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 “逆序”中二进制树的级别顺序遍历,具有O(n)时间复杂度 - Level order traversal of Binary Tree in “Reverse Order” line by line with O(n) time complexity 具有n = 2 ^ k-1个节点的完整二叉树。 描述一种用O(lg n)最坏情况下的时间复杂度执行此操作的算法 - Complete binary tree with n = 2^k-1 nodes. describe an algorithm to do this with O(lg n) worst case time complexity 该算法的时间复杂度是否为O(N ^ 2)? - Is the time complexity of this algorithm O(N^2)? 为什么此算法的复杂度为O(n ^ 2)? - Why is this algorithm O(n^2) in complexity? 二叉树的直径-算法复杂度 - Diameter of Binary Tree - Algorithm Complexity 提高这种二叉树算法的复杂度 - Improving this binary tree algorithm complexity 此算法是O(1)还是O(n)空间复杂度 - Will this algorithm be O(1) or O(n) space complexity O(n log n)时间复杂度算法? - O(n log n) Time Complexity Algorithm? 是否存在一种稳定的排序算法,可以对 O(n) 时间复杂度和 O(1) 辅助空间复杂度的二进制数组进行排序? - Does there exist a stable sorting algorithm that can sort a binary array in O(n) time complexity and O(1) auxiliary space complexity? 在 O(n) 中创建二叉树 - Create a binary tree in O(n)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM