Saturday, March 28, 2015

Week 11: Revisiting an Earlier Slog Posting

           For this entry, I decided to read my slog entry from week 5, which was my impression of tracing recursion. The first thing I noticed from reading it was how I did not necessarily understand why we even did recursion. My opinion on it was that it was a neat little trick and an alternative to using loops, which can get complex and long-winded at times. Of course with two weeks left in the semester, I now know that recursion is a powerful tool that is crucial for implementing various methods in trees, binary trees, and possibly for many of the other data structures out there.
           I appreciate the fact that the instructor first got us comfortable tracing recursion as a way of easing us into recursion and to allow us to understand the process of how it works. In my opinion, it got me to be good at tracing recursion, determining the output, and becoming comfortable enough to start writing recursive functions. I could tell by reading my writing that I was not fully engaged in the activities and did not take it seriously, only focusing on getting the right output instead of being cognizant about how the output was being generated with recursion. I really paid the price because if I had been more cognizant, I believe I would have had an easier time in the beginning when we got down to writing recursive functions ourselves. I did not even notice that every recursive functions had a base case (i.e. the smallest possible version of the original problem) and the general case, which breaks down the original problem. It took some hard work to recover and catch up. I guess in a way I agree with my past self in that the tracing was actually “the calm before the storm” of the actual implementation of recursion.
The lesson learned is to not just do things for the sake of finding the answers but think about the process as well in future courses. That is what learning is. I really do believe that I am solid with recursion now. Of course, there will be those curveball problems that will challenge me, but as long as I stay calm and remember my training from this course, I do not foresee any problems occurring. I reacted to my hardships by doing the lab exercises while understanding why the answers are the answers and reviewing notes from lectures. It all comes down to practice.

With this entry, I also decided to look at other people’s recursion-tracing experiences. Christopher (http://www.mybigfatcsc148slog.blogspot.ca/) and I shared similar experiences with tracing recursion. He too did not face many difficulties tracing and rather, found it to be simple, and appreciated the instructor getting us to practice tracing first. I liked how he thought recursion was not going to be “that bad” because that’s how I felt too. It looks like later on in his summary of recursion that he rather enjoys recursion, whereas I’m “cool” with it. I guess people differ in strengths and weaknesses. 

Friday, March 20, 2015

Week 10: My Impressions of Week 9

Week 9 was one of the more uneventful weeks in this course. Perhaps that was because we only had one hour of lecture and no lab due to the ongoing TA strike. The lone lecture was on more advanced binary search tree topics namely the insert and delete functions of the BST node. I felt like they were just an extension of the last few weeks’ lectures. It got me to review BSTs more thinking it would be on the test. While it did not have direct carryover into the test, we did come across a question with a BST that was of lower difficulty so it was a big help there.
           I would assess the difficulty of the test as fair. However, my experience was far from encouraging. After consulting with my classmates after the test on Wednesday, I realized that I made some critical mistakes right from the first question, which asked what the maximum height of a 20-node tree could be. The answer was 20 but a combination of fatigue and butterflies in my stomach caused me to mess up on that question. The BST question I got through no problem mostly because fortunately the answer was very similar to an example I had on my aid sheet. However, the last question concerned linked lists and that really tripped me up. I answered to the best of my abilities but having been introduced to the concepts a mere week earlier, I was not as solid as I would have liked to be. It takes me longer than most people to understand concepts sometimes. The combination of the lack of time and the stress caused self-doubt and confusion while attempting to answer the question. I think I got the general framework from referring to my aid sheet but I know I messed up somewhere. Overall, I was racing against time the entire test and I don’t expect the outcome to be anywhere near how I did in the first test, which I did well on.
           I learned I really need to shore up my understanding of linked lists and binary tree traversals before the final exam. I looked at the syllabus again recently and I noticed that the final exam is worth a whopping 40% of our course mark. Talk about high stakes. I could afford to make mistakes in the midterm because it will only be worth 6% at the end. I have to do everything in my power to make all the right moves when the final exam comes so I can end the school year with a bang and hopefully get into the program.
           For some inspiration, I again scrolled through some slogs. Like Christian from last week, Rod (http://rodcsc148.blogspot.ca/) has written a very nice slog this semester with illustrations and clear and precise explanation of concepts. His most compelling entry was his latest one about his impressions of week 9. He identified the importance of critical and deep thinking before actual coding and appreciated the instructor’s algorithmic approach to implementing the delete function of a BST node. In writing, he said he would take the same approach of the instructor and Rod, I shall do the same. Like me, he found the test to be more than fair, but seems to have experienced more success than I. He credits his success to doing the lab exercises in advance because he found the test questions to be variants of the lab questions. Rod, thank you for pointing that out and I will make sure to prioritize labs when studying. To anyone that actually reads my slog, I would definitely suggest Rod’s slog.

           I would really like to ask my fellow classmates to read my slog (I put quite a bit of thought and work into it) and leave comments. You will make me very happy if you do. I endeavor to do the same.

Thursday, March 19, 2015

Week 9: My Impressions of Week 8

Amidst the frenzy of the strike and the mad dash to hand in our assignment, we learned what linked lists are, yet another type of data structure. The instructor described linked list structures as “objects (nodes) with a value and a reference to other similar objects”. I had no idea what he was talking about at first but then like I did in the past with object-oriented programming, I thought carefully about the name “linked lists”. From the term “linked”, I derived the fact that the elements within a linked list were “linked”, which I think means that each element is aware of the one succeeding it and can therefore manipulate it somehow. Unlike the Tree and Binary Tree classes, this data structure requires two classes, an “LLNode” class and a “LinkedList” class. The LLNode class represents the “node” to be an element in a linked list. It both keeps track of the data, which can be any object, of the current node and the next node, which could either be the same LLNode or None, if the current node is the last of the list. The class LinkedList is what is known as the “wrapper class” for the LLNode class. Wrapper classes are called what they are because they “wrap” a data type into an object for that class. In this case, the LinkedList class has LLNode objects as the “values” and keeps track of information about the entire list, including the front and the back of the list, and its size.
           While we used recursion to traverse through trees and binary trees, we only used iterative methods to work with linked lists. “Walking along” a linked list did not seem hard to me when the instructor explained it. However, when it came to changing the nodes’ values or deleting or adding nodes, it was definitely harder than doing that with any old regular python list, which you can just do with indexing and aliasing. For me, it was very confusing to keep track of what the next node was going to be after deleting or adding the node of interest in the middle of the linked list and then shifting the rest of the nodes forward or backward. Although the instructor did his best to explain the concepts behind it all, it was ultimately up to me to apply the tools he gave us. The lab was quite challenging and while it would have been nice to have TAs’ support, I failed to execute the exercises so I have no excuse for that. I certainly did pay for it by not performing well in the linked list portion of the test.
I am finally starting to understand how to work with trees and binary trees but this linked list was just another live grenade thrown into the fray. Sometimes I feel that this course is moving too fast. What I will do to address the issues is to follow the advice of the instructor, which is to draw diagrams when working on linked list exercises and spending extra time outside of class to review concepts introduced in class so that I am prepared to get right into applying the tools when it comes time to practice. Hopefully the next few weeks these concepts will come together for me and any others who might be struggling.

I took the time to look at a few slogs of my classmates this week and I must say my good friend Christian’s slog (http://christiangarciacsc148.blogspot.ca/) is quite good. You can tell even by skimming through his entries that he takes special care by attaching pictures, pasting special pieces of code that are of interest, and editing his writing to make them more readable, which is something I must work on. His explanations of concepts are very clear and concise. His latest entry was also on linked lists and while he and I are together in terms understanding the basic idea behind linked lists, he does seem more enthusiastic about learning more about them, which I admire. He also seems to care more about other people’s slogs, as I have mentioned them once before, which the good guy here makes sure to give a shout out to his classmates every week. I will fix that myself in the coming weeks. Overall, his slog is of high-quality and I might just use his slog when reviewing for the final exam!
(disclaimer: I wrote during the 9th week but forgot to upload from my word document so I am uploading now during week 10)

Sunday, March 8, 2015

Week 8: My Impressions of Week 7

Coming back from reading week, I definitely was not as focused and engaged as I should have been. A lot of things were on my mind, including the upcoming 2nd assignment and the potential strike of the TAs, which ended up happening and is still going strong as of now. At first glance, the assignment seemed just as challenging as the first one, if not more. However, since we were given starter code for the game_state and substract_square_state, it was therefore not nearly as abstract in that we were told exactly the functions to implement. This game was a lot tougher than the subtract square game but it was manageable. Once I designed a working board-like structure crucial to the game play, implementing the rest of the functions that were concerned with applying move, returning the possible next moves, and announcing the winner was not a problem. It was fairly straight-forward to earn the 40% that was attached to the tippy game state, tippy game move, and the annotations to the game view in order to play tippy.
 I wish I could say the same for the minimax strategy we had to implement but it was a tall order. It tested us thoroughly on our ability to apply our knowledge of recursion in a game theory context. Minimax is a strategy designed to guarantee victory so long as the player using this theory goes first and there is infinite time and information to make decisions. The player envisions all possible moves from a game state and what outcome each move will lead to, through many more possible next moves. The base case for this recursion case is to check the outcome of the game state (i.e. a win, loss, or tie). If the base case is not reached, this means that there are legal moves available. The process now is to consider each available move and the game states that each move could lead to. From here, the player using minimax is to basically pick a move that would not lead to his or her loss. Our group needed to take our sweet time to discuss a game plan to write the code for it. I was not as involved in the process as my other teammates were because I was more focused on writing the code for the tippy game state. However, I had great teammates who were able to manifest our plan into a working code, so I am grateful for that.

Even in class, I could tell my classmates and even the instructor were pre-occupied with thinking about the assignment. I was glad the instructor spent a good amount of time explaining possibly confusing things about the assignments because otherwise we would have been somewhat lost. The classroom content involved binary trees, which I found to be a particular extension of the tree concepts so I did not find the material to be too much of a jump from the week before. What I need to do is catch up a bit on reviewing class notes because I have been neglecting them in favour of excelling on the assignment. The second test is coming up, which means I need to get studying. Fun.