blakeembrey / code-problems

Common code and interview problems solved in multiple languages

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Misleading framing of question

Akhilj786 opened this issue · comments

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

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.

@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.

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 😄