由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - Link nodes at same level in a binary tree 怎么做?
相关主题
Find number of subtrees with the same value今天上一题
Google Front-end Software Engineer Phone Interview请教一个Leetcode付费题
How to find the kth biggest number in a BST[合集] Google Phone Interview
BST 找重复节点数这个Binary Tree的题来看看
recovery BST 不考虑相同值的情况么?请问如何求binary tree的lowest common ancestor
Amazon 打印给定node距离最近的K个nodesfind kth smallest node of bst
Print a binary tree in level order but starting from leaf node up to root问个老题,find the next larger in BST
两个有点难度很有意思的题微软面试的一道题
相关话题的讨论汇总
话题: node话题: struct话题: level话题: tree话题: nodes
进入JobHunting版参与讨论
1 (共1页)
i***0
发帖数: 8469
1
You are given a binary tree:
struct node
{
int n;
//
value of node
struct node *left;
//
left subtree
struct node *right;
//
right subtree
struct node *level;
//
level pointer (node “to the right”)
}
Initially, the level field is set to NULL.
1. Write a function that will link all the nodes at the same level in a
given tree.
void linkSameLevel(struct node *t);
2. Please explain what the running time and memory usage of your function
are for a tree of depth d
containing n nodes.
For instance, if
h***r
发帖数: 726
2
BFS should work.

【在 i***0 的大作中提到】
: You are given a binary tree:
: struct node
: {
: int n;
: //
: value of node
: struct node *left;
: //
: left subtree
: struct node *right;

1 (共1页)
进入JobHunting版参与讨论
相关主题
微软面试的一道题recovery BST 不考虑相同值的情况么?
问一个很简单的suffix tree问题。请指点。Amazon 打印给定node距离最近的K个nodes
A家,link all node in the same levPrint a binary tree in level order but starting from leaf node up to root
关于inordertraversal 的iterative way两个有点难度很有意思的题
Find number of subtrees with the same value今天上一题
Google Front-end Software Engineer Phone Interview请教一个Leetcode付费题
How to find the kth biggest number in a BST[合集] Google Phone Interview
BST 找重复节点数这个Binary Tree的题来看看
相关话题的讨论汇总
话题: node话题: struct话题: level话题: tree话题: nodes