Skip to main content

Questions tagged [binary-tree]

5 votes
5 answers
1k views

I implemented a recursive solution that compares the left and right subtree in mirrored fashion. It works for my test cases, but I would like to know if there are any best practices that would make ...
Jared McCarthy's user avatar
2 votes
2 answers
704 views

I need to perform a deep copy of a binary tree using the Morris traversal. I think I managed to do it, that is the code below returns what I expect; however, I am not 100% sure I have covered every ...
Slav's user avatar
  • 121
2 votes
3 answers
178 views

I was trying to find the Maximum sum BST of a binary tree on LeetCode. While the Java code I have come up with, mostly seems right and is able to pass 55 out of the given 59 test cases too, the error ...
Siddharth Garg's user avatar
2 votes
1 answer
108 views

Introduction I have this semi-dynamic range minimum query (RMQ) tree in Java. It is called semi-dynamic due to the fact that it cannot be modified after it is constructed. However, the values ...
coderodde's user avatar
  • 32.3k
2 votes
1 answer
117 views

Problem statement: Sort integer array nums in O(N log N) time, without relying on any library sort routine. I am trying to use a tree sort method (using the ...
qxzsilver's user avatar
  • 123
5 votes
2 answers
266 views

Its been done to death, but the particular prompt (see Assignment 4) guiding me has strict+simple requirements that lead to a nice reduced environment to critique poor form. The project implements a ...
shea's user avatar
  • 153
4 votes
2 answers
155 views

Problem Statement Given a root node reference of a BST and a key, delete the node with the given key in the BST. Return the root node reference (possibly updated) of the BST. Basically, the deletion ...
iskander's user avatar
  • 121
5 votes
1 answer
134 views

Given a binary search tree, the problem requires calculating the minimum absolute difference between any two keys in the tree. Given the binary search property, the minimum difference must be between ...
loonatick's user avatar
  • 153
3 votes
3 answers
994 views

I'm playing around with a toy implementation of binary trees in C. I have a typedef'd struct BTree like so — ...
ZarakshR's user avatar
  • 145
15 votes
5 answers
4k views

I have tried to implement my Heap in C. The following are the 13 operations defined: build_maxheap insert exctract_max (delete heap max root) max_delete (delete an element or key) max_heapify clear ...
V_head's user avatar
  • 575
2 votes
1 answer
127 views

I've written a program that uses a binary tree to essentially 'learn' about animals given the name and questions about them. Learn is probably a little strong of a word, all it does is store the ...
ravenclaw900's user avatar
1 vote
1 answer
195 views

So I have this binary spaced partition leaf: ...
Aspect11's user avatar
  • 135
3 votes
2 answers
337 views

My code for a Binary Expression Tree that takes postfix input from the user and recursively builds and evaluates the expression. Proper input can be assumed. ...
MadHatter's user avatar
  • 865
2 votes
1 answer
195 views

I am trying to solve the lowest common ancestor problem in Rust. It is guaranteed that the id's of the tree are unique. It is also guaranteed that the two nodes which we are looking for in the tree ...
Agnishom Chattopadhyay's user avatar
4 votes
1 answer
3k views

I have an assignment due Friday to make a family tree. Started to code in January. My reviews from the teacher for this code was that the use of pointers was horrendous and it wasn't OOP enough. This ...
Shayeza's user avatar
  • 43

15 30 50 per page