Monday, 11 November 2013

CSC 148 SLOG for Week 9

         This week we learned about sorting algorithms and their efficiencies. I only learned selection sort, merge sort and quick sort in high school, and we didn't touch on the fancier ones such as bubble sort and Tim sort. I think that sorting is very algorithm-oriented, therefore as long as you can follow the recursive steps you should be able to understand sorting pretty easily. However it bedazzles me how the inventors of these sorting algorithms came up with it since it is so clear and straight-forward when you read it but it's a completely different story when you want to devise one yourself. They also have to consider about efficiency and when is the optimal time to use their sorting method. I also feel the same way when I am studying mathematics. The proofs of the theorems or the ways to solve a problem all appear pretty easy but when you are the first one to come up with it they would become so difficult. There is no exercise this week. I finished the assignment the week before so I just had to submit it. However my teammate did find an error with the code so I went back and analyzed it. It was a really stupid mistake. I had use the length minus the iteration variable for checking the divisibles instead of length minus one. The lab this week was also pretty straight-forward in that it tests our knowledge about linked lists.

         I agree with the author of http://csc148courseblog.blogspot.ca/ in that stars are very hard to handle in assignment two since they do not have parentheses accompanied with therefore making the checking procedure more complicated in part one. However I found a good way around it which is that you check whether at that symbol "*" the number of parentheses is zero and I checked from the back since stars are always the last character of a regular expression and it saves some checking time this way. The star would become more of a nuisance in part two where I didn't know how to partition the string for checking since star would make the number of characters indefinite. In the end I just checked for every single group of characters divisible by the length of the string on the left of the star.

No comments:

Post a Comment