Thursday, 27 March 2014

week 10

I found assignment 2 part 2 hard, mainly is_regex and figuring out how to work with the different trees. I spent a lot of time on it and learnt more about recursion and making base cases for the simplest cases, as well as breaking bigger problems up into simpler ones. I learnt about not wanting to set a parameter to an empty list, because it gets very complex. Rather to check if there is a list already and if there isn't, then to make one. Also, in the lab this week it was about linked lists and binary tree. What I found difficult about this was manipulating individual nodes and accessing different parts of the lists.

week 9

I find the binary search tree interesting as well as the method to implement it. It seems so simple but gets a bit complex for myself when coding in regards to deciding if a node is smaller than the next node and how to place it. I will keep going over this until it clicks for me. I do appreciate that the Tree class can be expanded into more complex codes and structure, that use its basic structure of data which connects to a left and right subtree. I learned from the exercise that a preorder and in order traversal can give you enough information to make a tree. I didn't exactly understand the algorithm performance and behaviour part or how it co-relates to how fast an algorithm will run or how to read the informations given for this?

week 8

I used to confuse the idea of linked lists, with them being one item like a list. Now I realize they are individual items that can be connected, but in a way are still individual. It was useful for them to be explained as either a value with a list connected to it (as if there are only two "items" or as individual objects referring and connected to other objects. I don't understand the point of a wrapper function or more specifically how you use it? I find linked lists interesting and I will keep reviewing the slides, codes and and practice exercises I find, to grasp a better understanding of them. I felt that part a of assignment 2 went well and actually bettered my understanding of tree's, their class and traversal. I was worried before that I wouldn't get a good opportunity to really understand them, but the assignment helped break them down. Even though the assignment was troubling in understanding what it wanted in the beginning or even grasping what regex was. After spending some time with the handout for this assignment, I felt I got the picture.


week 7

I find it interesting that tree and lists and recursion can all be combined to create linked lists. Do nodes the hold data, if they contain cargo? Can there be more then one thing of data in a node? Why is the empty list represented by None, why does there have to be something in the linked list, is it because it has a certain structure, where certain elements have to go? For the second part in a linked list of "a node that contains a cargo object and a reference to a linked list", does that mean the cargo object is referring to the list ? or that the node takes on this recursive structure and acts like a linked list? Are nodes and cargo the same thing, because "the string representation of a node is just the string representation of the cargo" and nodes contain cargo data? I find it interesting that the lists can be looked at by themselves and as a unique list with its own memory address, then they can also be intertwined with other lists to create a bigger list and structure. I also find it interesting that this linked list structure has similar properties of a tree structure. I tried the code on the reading for week 7, to make sure I get the grasp of it (while looking back at the reading to understand what i'm doing). I now realize that the point of None is to show where the list ends and that every Node needs None set for self.next, because of the case where it actually is the end of the list. For list collection, I don't understand how the computer would know what the first node refers to and why you only need to put it in as a parameter to print_list. Is it because it is linked via self.next, to the other nodes? Yet, it says that "there is no variables that refers to the other nodes. We have to use the next value from each node to get to the next node". How do you specifically use next value from each node and where do you use it in the function? For the function "print_list" and "print_backward" I don't understand why they say they can't have a method? I don't understand how you can't use None in a method? What's the real difference then between a function and a method? I learned that you can use wrappers and helpers to divide up operations of what you want a method to do.