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,126
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.5k
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,126
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,126
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,126
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,126
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 ...
Chris's user avatar
  • 6,126
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 ...
Thibe's user avatar
  • 401

Top 50 recent answers are included