c2c2017 icon indicating copy to clipboard operation
c2c2017 copied to clipboard

Add solution for BinarySearchTree

Open Showndarya opened this issue 6 years ago • 2 comments

Solution for the BinaryTree problem in Session8. Answer for question in BinarySearchTree.java in comments. Comments for each function also included.

I observed that the solution for LinkedList was present already. So, didn't add that.

Showndarya avatar Apr 08 '18 07:04 Showndarya

tl;dr Hi @Showndarya , thank you for the PR. I appreciate your initiative, and it is an excellent attempt. Please see comments, and update your PR.

The long version I see that you're a student in the C2C 2018 cohort, and once again, I admire your willingness to learn. Please do note that the above comments are something you would have learned before we reached this topic. We focus a lot on good design.

Some broad improvements you can make:

  1. Follow the code-style of the project. Look at how the code is structured in the rest of the repo, and try to mimic it. Before you contribute to any project, it is important that you follow their code-style, rather than your personal choice.
  2. Don't use global "flags".
  3. Don't use an IDE (at this stage). It inserts boilerplate for you, and more often than not, you don't need it (at least not for this course). You should think long and hard before you add a public function to a class.
  4. Contrary to popular belief, comments aren't really that great. Robert Martin (Uncle Bob) has a fantastic one-liner on this, (I paraphrase) "It is a mistake to think that a programmer who failed to express his thought in code will be able to do it in English." Avoid comments. Put them only where absolutely necessary, and then think if you can restructure your code to make the idea clearer.

If you want, go ahead and make the above changes, and I'll review again.

Cheers and happy learning 😄

havanagrawal avatar Apr 12 '18 19:04 havanagrawal

Thank you for the review.

I have taken all the improvements and suggestions into consideration and have come up with a more refined solution.

Let me know if more changes are required.

Showndarya avatar Apr 17 '18 13:04 Showndarya