All Questions
18 questions
3
votes
2
answers
411
views
Implementation of a market that matches bids to offers
This is my task:
Each line in the file can be one of the following:
Updates to the limit order book in the following format:
...
5
votes
1
answer
3k
views
Calculating the average of all nodes in a Binary Search Tree using visitors
I'm required to calculate the average value of all nodes in a BST using a Visitor, I'm not sure if I did this correctly or if i could just calculate the average ...
7
votes
2
answers
4k
views
Loop for inserting a node into a binary search tree
I am trying to implement binary search tree. One method which I am trying to implement in the most efficient and stylish way is node insertion.
I am under the impression that while (true) is a bad ...
1
vote
2
answers
391
views
Check if a tree is a proper BST [closed]
I have a function that takes the root node as input and needs to return if the tree is a proper BST as per the definition below:
The data value of every node in a node's left subtree is less than
the ...
3
votes
1
answer
2k
views
Deletion of a node in a binary search tree
I am looking to see if my implementation of the removal/deletion method in a binary search tree is sufficient, readable, and runs in \$O(\log n)\$ time. It's been awhile since I've written a data ...
3
votes
1
answer
850
views
Binary search tree class in Java
I am trying to create a binary search tree class in Java and am wondering how I did. I am fairly confident on most of the methods, but fear I may have messed up the delete method. I know I am ...
4
votes
3
answers
995
views
Binary search tree implementation (with Node class)
I have implemented the Binary Search Tree in Java and would love to get reviews. I would like to have some comments on multi thread implantation.
Note: Corrected Code is in the Answers
...
4
votes
3
answers
8k
views
Recursive Level Order traversal
I have come up with this code to do level order traversal recursively for a binary search tree.
...
5
votes
3
answers
10k
views
Binary search tree with tree traversal
Although there are several implementations of binary search tree, I have made my own implementation for practice. The following code does the followoing operation
- Create a binary tree
- search ...
4
votes
2
answers
413
views
BinarySearch Tree implementation & traversals
I am practicing various tree algorithms and that require code review for it's efficiency, clarity and also if it can be made better etc.
Is there a better way to call ...
1
vote
1
answer
8k
views
Search an element/item in an n-ary tree
Search an element in a n-ary tree. Looking for good code practices, optimizations etc.
If question is ambiguous, let me know and I will reply ASAP.
Note - ...
4
votes
2
answers
1k
views
Testing to see if tree is BST
I found a function online that tests if a tree is a binary search tree:
...
3
votes
2
answers
6k
views
Generic binary search tree implementation
I use this interface for my BST node class:
...
5
votes
1
answer
2k
views
Duplicate detection and reporting in a BST
For the purpose of this problem, the BST is defined to allow duplicates, and the duplicate values will always follow to the right-side of the parent nodes with the same value. For example, with the ...
3
votes
1
answer
1k
views
Binary Search Tree insert method (map interface)
This is my implementation based on Map<K,V> interface. The BST is a linked binary tree with root reference, both internal and external nodes (...