CST 370 Algorithm - Week 3

 This week's assignments are more challenging than previous weeks, but in an odd way. The Depth-First Search, the Breath-First Search and the Travelling Salesman Problem are all easy to understand and evaluate. Similarly, Divide-and-Conquer as well as Master Theorem are easy to digest as well. However, the recursive function is a big problem. It's easy to lose track and getting confused with recursive function. It is like getting stuck inside a maze where you go around and around.

But I used to study recursive function down in Community College, and there is an effective way to deal with it. Instead of going down (the beginning where we call the recursive function), we travel inverse. That is, we find the break cases first, which is the end of the recursive. Then, we can trace back to the beginning and find out how the recursive function is called. I have seen many cases, including myself, get lost inside the recursive, trying to figure out which is the right way to call the function.

(I'm also thinking of drafting a model to show how to handle the recursive function, but I am not sure yet)


Moving on to the programming assignments. As I mentioned above, this week's assignments are odd. Underestimate and approach hastily will be costly. Thanks for my habit, learned from strict study environment, I work on the programming assignments step by step cautiously. I can sense the usage of recursive function also but decide it is best to make the program works first before switching to recursive.

Picture 1: I make sure the program works first


Picture 2: Then I switch to Recursive (also to challenge myself)



Comments