Wednesday, March 5, 2014

Week 8

HIIIII everybody, welcome back to my week 8 CSC148 blog. I hope everyone had a great week. This week is not too bad for me. Although part A of assignment two is due tomorrow, me and partner has done almost 95% of it so I'm not worrying about that so much right now. I'll talk about assignment two later on.

Right now, let's talk about the new things that I've learned this week. In this week's lecture, the idea of linked list was introduced. Sounds cool right? In CSC108, I've only learned about lists. But this time, it's linked list. So basically a linked list is lists that are linked together (NO ****!). It is another structure used to store data. It is different than a Tree. In a tree, the root can have multiple children; In linked-list, each node only contains a head and a tail. Head contains a value(or an item), and the tail is linked to the head of the next list. What this means is that the tail of a list is actually the head of another list. Found it confusing? check this out:
File:Singly-linked-list.svg

As you see in the first list, 12 is the value of the head. and its tail is connected to the head of the next list. Basically the tail of the first list is starting from 99 and everything behind it. If you want to insert something, let's say 15, between 12 and 99. First, you have to set 99 and everything behind it to the tail of the list containing 15. Then, set 15 and everything behind it to the tail of 12. After these two steps, 15 will be inserted between 12 and 99. I hope you'll have at least a basic understanding of a linked list now.

Ok, now I'll talk about assignment 2. Assignment 2 is all about Regexes and for part 1, we have to write a function to create Regexes. I'm sure many of you will have this question in your mind: What are Regexes? Regex is an abbreviation of regular expression which is used in many of the programming languages to match classes of strings. In this assignment, we're responsible for regexes over the ternary alphabet {0, 1, 2}. It is a non-empty string that consists of the symbols '0', '1', '2', 'e', '|', '.', '*', '(', ')'. In the regexes '0', '1', '2' don't have any children. '*' has one and '|', '.' has two. Because Part A is due tomorrow so I won't share my codes here. Basically we have to write a program to create the Regexes that I have mentioned about.

So that's it for this week's blog. I'll see you guys next week.

No comments:

Post a Comment