New answers tagged binary-search-tree
2
votes
Binary Search Tree implementation in C [1]
Style
You mix braces and not using braces freely throughout your code. While this works, it leaves open the possibility of adding to branches of conditionals or to loops and forgetting to add braces, ...
3
votes
Implementation of a balanced binary tree
Implement the interface of std::map
To make your code be a drop-in replacement for standard library containers,
try to implement the same interface for your ...
1
vote
AVL Tree in C++
In rebalance(), establishing the height before potentially rebalancing looks wrong.
There are two if-else statements where both ...
Community wiki
2
votes
AVL Tree in C++
Example use cases
There are a few opportunities here.
Don't use magic numbers. 100 and 99 are used with respect to the ...
2
votes
Binary Search Tree implementation in C++ with templates
printValues
Let's consider a function with opportunity for improvement.
...
2
votes
Pet Shelter in C++
findParent
There is a redundancy in struct ShelterBST::TreeNode* ShelterBST::findParent(struct TreeNode* root, std::string name)....
2
votes
Schedule using binary tree in C
Indentation
More than a single space for indentation makes code much easier to read. Four spaces is a very common convention for C.
Nested conditionals
Let's consider one function, with improved ...
8
votes
Implementation of a balanced binary tree
Some notes.
Indentation
I would strongly suggest four spaces rather than two for each level of indentation. With such minimal indentation, your code is a bit hard to follow.
You may get value out of ...
3
votes
Weight balanced tree in OCaml
From a reviewer perspective I find it difficult to identify what the short variable and type names mean and thus for what they are used.
Note: I must admit that I am not familiar with the language ...
Top 50 recent answers are included
Related Tags
binary-search-tree × 42c++ × 19
tree × 9
algorithm × 7
c × 7
python × 5
binary-tree × 5
python-3.x × 4
time-limit-exceeded × 4
pointers × 4
object-oriented × 3
programming-challenge × 3
linked-list × 3
java × 2
c# × 2
c++11 × 2
reinventing-the-wheel × 2
rust × 2
javascript × 1
performance × 1
beginner × 1
.net × 1
sorting × 1
recursion × 1
comparative-review × 1