blakeembrey / code-problems

Common code and interview problems solved in multiple languages
MIT License
3.81k stars 509 forks source link

Misleading framing of question #157

Closed Akhilj786 closed 9 years ago

Akhilj786 commented 9 years ago

I believe the question is to check whether it is BST(Binary Search Tree) or not?? And not construct a BST.

https://github.com/Akhilj786/Algorithms/blob/master/src/Trees/TreeCheck.java#L25-L35

blakeembrey commented 9 years ago

Sorry, I was meant to respond earlier. Are you talking about https://github.com/blakeembrey/code-problems/tree/master/problems/binary-search-tree-check? The linked code doesn't provide any context.

Akhilj786 commented 9 years ago

@blakeembrey yes i was talking about the same problem. I guess from that link i was trying to making use of the BST property. i.e Node > Max(Node.left) and similarly for the other side.

blakeembrey commented 9 years ago

Ah, I see what you mean. It's specifically the Java implementation. Yes, it should be mostly psuedo code to show what is happening and there shouldn't be a complete BST implementation inline - but I'm not going to remove it right now. I'm welcome to accepting a pull request :smile: