Skip to main content

New answers tagged

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, ...
Chris's user avatar
  • 6,604
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 ...
G. Sliepen's user avatar
  • 69.6k
1 vote

AVL Tree in C++

In rebalance(), establishing the height before potentially rebalancing looks wrong. There are two if-else statements where both ...
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 ...
Chris's user avatar
  • 6,604
2 votes

Binary Search Tree implementation in C++ with templates

printValues Let's consider a function with opportunity for improvement. ...
Chris's user avatar
  • 6,604
2 votes

Pet Shelter in C++

findParent There is a redundancy in struct ShelterBST::TreeNode* ShelterBST::findParent(struct TreeNode* root, std::string name)....
Chris's user avatar
  • 6,604
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 ...
Chris's user avatar
  • 6,604

Top 50 recent answers are included