Assignment 2
Hey, sorry for not posting last week. I forgot :P
I've been busy for the past few weeks and will continue to be busy. I've already finished my assignment, so I can get it out of my way.
It took me much longer than planned to finish it. Implementing the is_regex() function seemed difficult at first but I tackled it by making it work with the "0", "1", "2" and "e" first and work my way upward.
I spent most of my time with the permutation function. I probably could solve it with less trouble with loops rather than recursion but I had a feeling we were expected to use recursion. I also had efficiency in my mind while doing this. After many hours of futile efforts, I eventually ended up using the per() function given in one of the lectures as a helper function.
The regex_match function isn't so bad as expected. I tackled it the same way as I did with the first function.
Finally, the last function was pretty easy to make. I based the codes of the is_regex function and make some small changes.

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home