Skip to main content
Advice
1 vote
9 replies
114 views

I have a binary tree which leafs have a size of 1, and the parent double in size at each level. I project those nodes on a linear axe (memory space). I need to get the equation that gives the adress ...
Simon's user avatar
  • 2,143
1 vote
2 answers
153 views

Let's say our binary tree (bt) looks like this: Node* root = new Node(); root->left = new Node("B"); root->right = new Node(); root->right->right = new Node("A");...
Arun Saini's user avatar
-1 votes
1 answer
112 views

I have a working recursive solution to check if a binary tree is symmetric. The code works correctly for my test cases, but I'm concerned about potential stack overflow with deep trees since Python ...
Jared McCarthy's user avatar
1 vote
1 answer
158 views

I'm trying to solve LeetCode 199. Given the root of a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom. I've ...
Benny's user avatar
  • 519
10 votes
3 answers
616 views

This is the code I have written for searching a node in a tree as a part of my assignment: typedef struct NODE { int key; struct NODE *left, *right; } Node; Node *search(Node *head, int key)...
M.B.'s user avatar
  • 279
0 votes
0 answers
44 views

Suppose I have a complete, perfect binary tree stored in an array. If I store node data in breadth-first traversal order (Eytzinger order), then if an internal node's index is i, its left and right ...
Alec Jacobson's user avatar
-1 votes
1 answer
91 views

I'm trying to solve the Binary Tree Longest Consecutive Sequence II problem (Leetcode 549). The goal is to find the length of the longest consecutive path (increasing or decreasing) in a binary tree. ...
fortnight learner's user avatar
2 votes
1 answer
300 views

I understand we can rebuild a binary tree from its inorder AND ( postorder OR preorder ) traversal. I however wonder whether rebuilding it from its postorder AND preorder traversal doable too?
Linda's user avatar
  • 319
-1 votes
1 answer
68 views

I was doing the GeeksforGeeks practice problem Vertical Tree Traversal: Given a root of a Binary Tree, find the vertical traversal of it starting from the leftmost level to the rightmost level. If ...
Sandesh Dubey's user avatar
2 votes
0 answers
68 views

I'm trying to implement a binary tree using an array. It means that the following tree 1 / \ 2 3 / \ / \ 4 5 6 7 would be as the array below: [1, 2, 3, 4, 5, 6, 7] So it means that the ...
Базакин Егор's user avatar
-2 votes
1 answer
60 views

def path_sum(root,temp): print("root is",root) if root == None: return False temp.append(root.val) if root.left == None and root.right == None: ...
data_geek's user avatar
1 vote
0 answers
93 views

I'm working on implementing a Double-Ended Priority Queue (DEAP) data structure in C++. I'm having trouble with establishing the correct implementation of node partnerships between the min and max ...
benhpark's user avatar
6 votes
1 answer
89 views

I am interested in methods for serializing and deserializing a binary tree in breadth-first order. The first part, serialization, is equivalent to performing a levelorder traversal where we preserve ...
Brendan Langfield's user avatar
1 vote
1 answer
85 views

I am trying to visually print out a simple binary tree in Java. Here is the full code: class WordPoint { private final String word; private final float pointValue; public ...
DBar's user avatar
  • 13
-4 votes
2 answers
234 views

I’m trying to implement a level-order traversal of a binary tree in C++ without using recursion. The goal is to traverse the tree level by level, starting from the root, and print the nodes in the ...
Naormeit's user avatar

15 30 50 per page
1
2 3 4 5
456