A number of personal commitments meant I had to take a break from the course, so I am just trying to get back on track now, albeit very slowly.
THINGS I’VE WORKED ON/COMPLETED…
I am currently working on the Binary Search Tree (have reached the delete method implementation (not yet finished).
ISSUES I HAD…
I (again) struggled with how to set variables within a function that uses recursion without causing an infinite loop. In spite of having taken an extended break, it actually clicked with me that I could just pass those variables as parameters and set their values within the parameters themselves. Hopefully, this is a sign that I have actually retained something.
I had another issue which, as many do, seems obvious only after I fixed it. I had been trying to ‘deal with’ possible array duplicates and filtering from within the buildTree function itself, which was causing problems. Somebody simply suggested to me that I should look for a way to sort and remove duplicates from the array from outside the buildTree (recursive) function and it suddenly occurred to me that I could do this with another method and then pass the result (sorted and duplicate-free array) to the buildTree function. Not sure why this didn’t occur to me earlier - I had it in my mind that it all needed to be ‘dealt with’ from within the buildTree function.
I struggled a bit with the insert method. Why? I believe it was due to not taking enough time to think through the steps of the recursive function as well as having forgot some things during my break. I admit that I had a ‘quick' peek’ at a suggested solution that appeared in the study material, as I felt stuck. One consolation is that I did work though it to try to understand what was happening, although I do not plan on taking ‘quick peeks’ again.
Once I had the insert method working, I still had doubts about how some parts of it were working as it seemed that my root was correctly updating even though to manipulate it, I had assigned it to a variable. I was baffled by this for a while, but someone helped me to understand that this was due to ‘passing-by-reference’ which I had admittedly forgotten about. I hadn’t forgotten its existence, I just hadn’t seen it in quite a while and wasn’t thinking about it when working through the code. I am glad I had issues with this, becaused I know it’s going to come up again and I will be more aware of it now.
THINGS THAT WENT WELL…
I managed to make progress (albeit a small amount) on BST this week, so I hope to my momentum going and to get back on track with the course after my break.
THINGS I’VE LEARNT/NEED TO IMPROVE ON…
I absolutely need to be more methodical when working out recursive problems and I absolutely need to train myself to be able to write down the workings of the recursive function, at least for simple cases.
By this, I mean writing down what is returned by each recursive call, to see what’s actually happening as I know I have not done this enough in the past and I think it will help me to improve, as recursion is still a little bit tricky for me.
OTHER…
n/a
PLAN FOR THE UPCOMING WEEK…
I would love to finish BST.
Top comments (0)