Wednesday, December 5, 2012

My Last Blog


     
     The last week of classes was very helpful for me. It made me grasp the whole idea of the finite state automata and the regular expressions.

     Last week focused on connecting both the DFSA and regular expressions together. In class the Prof showed us some examples of how to draw the finite state automata, which we already learned, but then showed us how to get the regular expression from it. To get the regular expression we basically need to eliminate all states in FSA diagram one by one, except for the starting and accepting states. And finally we produce the regular expressions from the simplified version of the finite state machine.

     Over all I find CSC236 a very helpful productive course that will stay with us for the rest of the years to come.
     
     The exam is held next week. Planning to have excellent results in the finals; thus, I will go over my lecture notes, the course notes, and tutorial exercises. If I have extra time left, I will also go over the last midterm, tests, and assignments. 

Monday, December 3, 2012

Regular Expressions



A regular expression is a powerful search pattern that is used in programming. It helps identifying sequence of words, characters, or patterns of characters. Regular expression is used in many computer languages like python, java , c, c++.

CSC236 is focusing more on binary digits, strings of 0s and 1s and the different ways to express them by using different regular expressions.

Some of the important characters that are highly used in our course are:
*(star) : Repeats the previous item zero or more times.
+         : Repeats the previous item one or more times.

Here is an example:
Lets say we want to write a regular expression that accepts a string that contains multiple of 3  0s
To write the description of the language we can write:
L = s in {0,1}*| s contains multiple of 3 0s

It is easier for me to reach the regular expression wanted is to give myself examples of what should accept the description of the language and what shouldn’t

examples
empty string,  1, 11, 000, 0100, 101010, 0100000, 000100100010 accepts
0,00, 10, 1001, 10000, 0101010, 0000110 does not accept

So by looking at these examples I can say that all the 1s could be anywhere in the location and would not affect the final result of the language’s description
Only the 0s matter

Then      3 * 0 = 0
                3 * 1 = 3
                3 * 2 = 6
                3 * 3 = 9
                3 * 4 = 12

Thus we should have (0 or 3 or 6 or 9 or 12 or …. And so on) 0s. all are multiples of 3

If we have a string that contains only 0s then our regular expression should look like this:
(000)*  by following the definition of the *(star) from above

But it is not,  we need to include the 1s in which they should not affect the 0s

Then I believe our regular expression should look like this
(1*01*01*01*)*

        Since I already started learning regular expression in my other courses, I find that CSC236 helped me strengthening my understanding of the language, as well as it cleared many questions that were running in my head.