binary-tree Questions

7

Solved

The fringe of a binary tree is the sequence composed by its leaves, from left to right. The same-fringe problem [Hewitt & Patterson, 1970] consists of determining whether two binary trees have ...
Sefton asked 15/6 at 15:38

3

I am in need of some clarification, this may be a really stupid question and I have done research but cannot find a clear answer to my question. My question is, What are some property differences b...
Rhinencephalon asked 6/12, 2019 at 2:47

6

Solved

What exactly is the top view of a binary tree? I find great ambiguity and lack of clarity from the articles I find. For example, this is what is used to demonstrate the top view on geeksforgeeks:...
Histology asked 22/4, 2020 at 18:4

6

I have visited many websites but couldnt find any algorithm for Morris postOrder traversal. I know that we can use Morris algorithm for preOrder and inOrder.It will be of great help if someone poin...
Ulibarri asked 3/4, 2016 at 10:57

6

Solved

It's a pretty normal binary tree, except for the fact that one of the nodes may be empty. I'd like to find a way to output it in a horizontal way (that is, the root node is on the left and expands...
Antineutrino asked 16/6, 2010 at 20:35

6

Solved

http://geeksforgeeks.org/?p=6358 Can anyone please explain how Morris Traversal has a time complexity of o(n)? In the traversal, whenever the node has a left child a copy of it is made to the right...
Mishnah asked 25/6, 2011 at 13:36

5

I can already convert an array into a binary tree using following algorithm in java: public class TreeNode { public TreeNode left, right; public int val; public TreeNode(int val) { this.val =...
Editor asked 12/11, 2014 at 16:26

7

Solved

I've got a perfect binary tree that's enumerated the post-order way. An example of such tree would be 15 7 14 3 6 10 13 1 2 4 5 8 9 11 12 The size of the tree is known to me. I'm looking for...
Perforated asked 5/12, 2013 at 16:27

4

I have been trying to wrap my brain around how to write code for rotation of binary tree. I looked at http://en.wikipedia.org/wiki/Tree_rotation and enfuzzled.com I have been staring at this for 2...
Gotcher asked 4/1, 2011 at 19:40

35

Solved

I need to find the kth smallest element in the binary search tree without using any static/global variable. How to achieve it efficiently? The solution that I have in my mind is doing the operation...
Treasonable asked 24/2, 2010 at 20:18

5

Solved

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? Thanks in advanc...

6

Solved

I saw several quotes about this on the Internet but no official documentation? Can anyone tell me where I can get information about this?
Gravel asked 16/2, 2013 at 11:39

5

Solved

So I've looked around the web and a couple of questions here in stackoverflow here are the definition: Generally, an internal node is any node that is not a leaf (a node with no children) Non-lea...
Geosynclinal asked 18/1, 2013 at 4:58

21

Which is the best data structure that can be used to implement a binary tree in Python?
Steinway asked 8/4, 2010 at 8:23

23

Solved

How can I print a binary tree in Java so that the output is like: 4 / \ 2 5 My node: public class Node<A extends Comparable> { Node<A> left, right; A data; public Node(A d...
Goncourt asked 11/2, 2011 at 3:28

4

Solved

I'm wondering if a max or min heap tree is allowed to have duplicate values? I've been unsuccessful in trying to find information regarding this with online resources alone.
Tradescantia asked 21/3, 2014 at 21:47

7

Solved

I am a "bit" lost trying to print a binary tree like below in c++: 8 / \ / \ / \ 5 10 / \ / \ 2 6 9 11 I know how to get the height of the tree and the number of nodes in each level, but ...
Dupre asked 22/4, 2016 at 20:0

9

Solved

I came across this problem that has Ternary expression (a?b:c) and needs the ternary expression to be converted into a Binary tree structure. a?b:c a / \ b c a?b?c:d:e a / \ b e / \ ...
Metropolitan asked 12/2, 2015 at 21:10

3

When making a binary max heap, why is it better to implement it as a array based, and not a tree based (tree based as in, each node also having a pointer to it's parent)? In terms of run time analy...
Scarper asked 5/2, 2013 at 23:37

8

The heap property says: If A is a parent node of B then the key of node A is ordered with respect to the key of node B with the same ordering applying across the heap. Either the keys of pare...
Rikkiriksdag asked 14/8, 2014 at 23:47

5

Solved

The image above is from "Wikipedia's entry on AVL trees" which Wikipedia indicates is unbalanced. How is this tree not balanced already? Here's a quote from the article: The balance factor of...
Grooms asked 23/10, 2008 at 18:20

4

Given a binary tree: Binary tree of height 3 I want to find the horizontal distance between two nodes at the same level also counting the nodes that are not there in between while not counting the...
Yehudit asked 21/2, 2019 at 20:43

14

Solved

Can anyone please explain the difference between binary tree and binary search tree with an example?
Burnie asked 17/6, 2011 at 0:42

6

Solved

if the input is an array, where null means no node. input: [1, 2, 3, null, 5, null, 7] Please assume that I have already checked the input. For each array[i], its parents array[i / 2] will not...
Benzoate asked 21/6, 2016 at 10:1

19

Solved

The following is an interview question. You are given a binary tree (not necessarily BST) in which each node contains a value. Design an algorithm to print all paths which sum up to that value....
Persse asked 4/7, 2012 at 11:37

© 2022 - 2024 — McMap. All rights reserved.