BST – the end in sight?



This content originally appeared on DEV Community and was authored by CodeCara

I did not post last week as I did not have much time to work on BST. I will keep this brief as my note-keeping was not ideal this week – something to improve.

THINGS I’VE WORKED ON/COMPLETED…

  • The LevelOrderForEach method
  • The preOrder, inOrder and postOrder methods
  • The Height method
  • The Depth method
  • the isBalanced method
  • The reBalance method (currently half-working, but need to finish off)

ISSUES I HAD…

I am still having issues figuring out return values and visualising how they affect the call stack as it unwinds. I am trying not to dwell on this though, as even though I sitll really, really have to think about it, I am still getting there and have definitely improved over time.

I got really stuck with the Height method and was unsure how to return cumulative, numercial values. I ended up googling and ‘accidentally’ seeing a solution. I did not copy it as such, I left it for a few days as was busy and when i came back to it, although I recalled some small parts of the solution, I wrote it out myself without checking the solution again. Not ideal I know, but it helped me to get my head around how to approach things and once I understood it, I had no problem applying a similar logic to the Depth method

THINGS THAT WENT WELL…

Even though I mentioned that I still have issues with return values and the unwinding of the callstack, I still think I am marginally better at it than I was before, so that it some progress.

THINGS I’VE LEARNT/NEED TO IMPROVE ON…

I should draw out the call stack and return values from each call when approaching recursive problems as it definitely helps to see things more clearly.

I noticed that I have frequently completely forgotten about the return value outside of the base case, which has obviously affected my code. I believe that if I follow (draw out) what is happening line-by-line, I would be much less iikely to do this.

I still feel like I need a lot more practice at recursion.

OTHER…

n/a

PLAN FOR THE UPCOMING WEEK…

I thought I would never say this as I have dragged this project out so much for various reasons, but I believe I should finish BST this week – tomorrow in fact. I will then be moving onto Knights Travails.


This content originally appeared on DEV Community and was authored by CodeCara