Saturday, 29 March 2014

Recrusion

     I have first encounter the idea of recursion in the forth week of csc148 classes. Through the first introduction reading, I thought the idea of recursion is very genius and fantastic. Recursion functions creates a loop or circulation that the function runs again and again within the function until it is instructed to stop.  
    The idea of recursion was complicated and I still think I need more practice to fully master it. As I have concluded, there are two ways of recursion. One is writing the function with in the completed full function like it is shown in the picture below.


The other form takes less words but more thinking. It is the abbreviate way of if statement. Here is an example below. 






Sorting and Efficiency

          Sorting is a very complicated topic. There are all kinds of sorts: quick sort, tim sort, merge sort, bubble sort, insertion sort….and so on. The sorting functions we learnt in csc108 is simple sort. The sorting functions we learnt this term is recursion.
          We also analyzed the run time of all those sorts. A faster tun time  contributes to more efficacy. Tim sort results the most efficient algorithm. 
           I felt that the sorting functions are easy to understand. However, the explanations of runtime are hard to understand. We have learnt the big-O theorem in csc165. The way they explained and calculate worst case  in 165 are more clear and easier to understand for me. 
          This is the second last week of csc148. I don't want to part with this exciting course. And there are also many regrets in this term that I haven't spent as much time on studying as I should. Maybe its because it's the exciting fresh new freshman year; I did too many social instead of studying. Now, with my regrets, I shall work hard towards the final and try to bring my marks up as much as possible.