Hot answers tagged

10 votes
Accepted

Simple tree dictionary structure in C

Hide the implementation: Node should be an opaque data type defined in the source file. The header file would then only contain the forward declaration, and the ...
Harith's user avatar
  • 3,967
2 votes

Simple tree dictionary structure in C

While the answer by Harith addresses very valid points, I feel that there is some repetition in this code that deserves to be eliminated. In particular, you see the following pattern arise a lot: <...
madmann91's user avatar
2 votes
Accepted

Semi-dynamic range minimum query (RMQ) tree in Java

Context RMQ is not as a well known problem as say sorting, so I personally had to search the web first to even know what this is exactly about. I had a quick look at the Wikipedia article, where one ...
morgwai's user avatar
  • 352
1 vote

Maximum Sum BST in a Binary Tree

Beyond method naming and a comment stating what the signature boolean isBST(TreeNode root,…) suggest, the code gives no indication what it is there for, what the ...
greybeard's user avatar
  • 6,286
1 vote

Maximum Sum BST in a Binary Tree

Is there anything I can change, in the same given code, that would optimize it and/or get it accepted? Your “Time Limit Exceeded” question is basically asking “when is this code slow?” We tend to ...
J_H's user avatar
  • 21.8k

Only top scored, non community-wiki answers of a minimum length are eligible