Another week has gone by and we are almost at the end of the course. For this week, I will write about the two new types of sorting algorithms we learned, and the second assignment, which involved regular expressions.
The two new sorting algorithms we learned during lecture this week were called the Quick Sort and the Merge Sort. The Quick Sort involves repeatedly choosing a pivot and sorting elements in relation to that pivot. While on the other hand, the Merge Sort involves splitting the list in half, recursively Merge Sorting both of the lists and finally combining (merging) the two halves together.
We also learned about the performance and efficiency of each of the algorithms which involved calculations like the number of steps to choose a pivot, the number of comparisons, as well as the number of times to split a list in half, etc.
Moving onto the second assignment, it involved Regular Expressions, which are similar to Trees and Recursion. My partners and I found the assignment to be not too difficult because of the various hints and tips given in the handout as well as in class. We had the most hardest time with the is_regex() and match_regex() functions.
My advice for this would be to really think about the base case(s) and recursive steps, and tracing the output. If you do not really understand how recursion works, then you should practice with simpler recursive problems which will help you gain a better understanding.
No comments:
Post a Comment