Tagged Questions
1
vote
2answers
69 views
Check if a Binary Tree <String> is aBinary Search Tree
i'm understanding the question but wanna make sure if my implementation is correct or not =|
The Q is :
Write a method that accepts as its argument a BinaryTree object and returns true if the ...
1
vote
2answers
108 views
How can this code become cleaner and less error prone? Especially the binary search part
How could this code become cleaner?
I think that the way I handle the interfaces and binary search could be improved.
I am trying to understand how to structure such a code 9and usage of APIs) in a ...
2
votes
1answer
207 views
Returning Binary Search Tree Nodes in Zig Zag manner
I tried to implement an answer for the algorithm question given below. I implemented two different solutions. I couldn't decide which one is better. ( Maybe none )
Note: Node class and ZigZag ...
1
vote
2answers
6k views
Deleting a node from Binary Search Tree
I have read about it at few places and tried to write my own version, would like to get it reviewed.
class Node {
private int value;
private Node left;
private Node right
// ...
0
votes
0answers
2k views
InOder successor and predecessor in Binary Search Tree
Do they look correct? I implemented them and was looking to review them
Node predecessor(Node node) {
if ((node.left == null) && (node.right==null)) {
return node;
}
if ...
5
votes
1answer
627 views
Implementations of prefix lookup tables in Python
I've got a fairly performance sensitive need for fast prefix lookup, and I've built two different implementations trying to optimize for my use case. The first is built off a Trie implementation, and ...
2
votes
2answers
2k views
Splay tree implementation
I am looking into splay trees and I implemented a version. It seems correct. Could someone please let me know if this indeed correct and how to improve it?
I will just show the insert item and splay. ...