All Questions
Tagged with binary-tree java
7 questions
2
votes
3
answers
150
views
Maximum Sum BST in a Binary Tree
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 ...
2
votes
1
answer
95
views
Semi-dynamic range minimum query (RMQ) tree in Java
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 ...
3
votes
1
answer
628
views
Huffman coding implementation in java
I wrote a simple huffman coding algorithm for learning and practice. I just used the technique given on the wikipedia page.
Could you tell me my missing points and mistakes?
Node.java
...
2
votes
1
answer
180
views
Leetcode 662: maximum width of binary tree in Java
I have the following solution to this problem. The idea is to compute the maximum width of a binary search tree. The width of a BST on a particular depth is defined as the distance from the leftmost ...
2
votes
1
answer
231
views
Sink algorithm in Max Heap Correctness
I am trying to determine the correctness of a helper method within my MaxHeap class.
The goal of this helper method is, given the index of any node in the Max Heap, sink it to the correct level in the ...
1
vote
2
answers
147
views
How can I optimize this Binary Search Tree?
I've added some methods to a basic BST implementation for integers - if anyone can point out some ways that this could be written in a more efficient or clean manner, please let me know.
...
3
votes
1
answer
49
views
I need to know that if everything okay in my BTS put and get method
I implement BinaryTree (K extends Comparable, V) concept to binarySearchTree and I have written get and put method. As far as I check, there is no problem in my code. So now I wonder that are there ...