Sorry, readers! I put off this post off for a bit...
The force of procrastination induced me to stay in my bed...
What happened this week?
Well, term test 2 happened to me...
How did it go?
Je ne sais pas
Say nothing
Think of nothing
Ignorance is bliss
I have lost my magical ball of grade prediction after completing 100000 midterms and 1000 quizzes since starting school.
Hence I will write about anything but speculation on my test scores.
Back on topic: course material
The most interesting concept we have learned so far is the binary tree, or specifically speaking, the binary search tree(BST).
A binary search tree is an ordered version of the regular binary tree.
Its left child's value is smaller than the node's value, and the right child's value is greater than the node's value.
I find this structure very intriguing! Every time I look at a BST, I think of holding the parent node and having other nodes dangling on the sides. Sometimes, the BST also reminds me of a christmas tree!
Overall, I think the implementations of functions that traverse through the BST are very challenging.
Here is an example from the lab:
def list_between(node, start, end):
''' (BTNode, object, object) -> list
Return a Python list of all values in the binary search tree
rooted at node that are between start and end (inclusive).
>>> b = BTNode(8)
>>> b = insert(b, 4)
>>> b = insert(b, 2)
>>> b = insert(b, 6)
>>> b = insert(b, 12)
>>> b = insert(b, 14)
>>> b = insert(b, 10)
>>> list_between(None, 0, 15)
[]
>>> list_between(b, 2, 3)
[2]
>>> L = list_between(b, 3, 11)
>>> L.sort()
>>> L
[4, 6, 8, 10]
'''
if node is None:
return []
else:
if is_leaf(node):
return [node.data] if (start <= node.data <= end) else []
else:
if start <= node.data <= end:
d = [node.data]
else:
d = []
left_list = node.left
right_list = node.right
return list_between(left_list, start,end) + list_between(right_list,start,end) + d
Functions involving more complex recursion, like the one above , really bring our progress one step further. Just earlier on in the semester, we were still implementing very simple recursive functions.
However, as of now, I still find it a bit intimidating to implement complex recursive functions(especially on tests, when the code cannot be tested). To increase my confidence on recursive functions, more practice will do. I will have to do the labs again!
Impressions on course logistics and student support:
As finals and A3 deadline approach in the vicinity, the TAs aren't helping us with the strike. We haven't had formal labs for more than two weeks. As a student in a course with tight deadlines, namely CSC148, I feel very nervous and anxious.
Office hours are immensely helpful; however, time is a big issue because I often have other classes to attend during office hours.
Let me end this blog post with optimism:
Despite all the turmoil we students have experienced, the end of the school year is still coming! May we find happiness even in the most stressful times! Let's hope for the best and keep working hard!
After all, practice makes perfect.
-----------------------------EXOCOETIDAEE.BLOGSPOT.CA-------------------------------------------------





"I have lost my magical ball of grade prediction after completing 100000 midterms and 1000 quizzes since starting school."
ReplyDeleteI COMPLETELY KNOW THE FEELING. Relief coming out of a test is no longer at all correlated with the mark achieved! Argh.
Also, I like your use of diagrams; both the BST and the Spongebob are compelling in their own ways.
Yes, haha, "relief coming out of a test is no longer" correlated with mark achieved. Thank you, I do like to use visual diagrams in my blog posts . :)
Delete