This week, CSC148 had a test. I studied before the test, so I felt pretty comfortable while writing the test. However, there was a part where I got little confused, that part is about recursive functions. I think the questions involved the list. First few functions were simple to trace, but on last question, I got an answer that I did not expected, and I could not doubt that tracing that I did for other functions were right. I need to understand what is recursive function inorder to understand it properly.
So what is a recursive function? On the course note it says recursive means"defining something in terms of itself." And I also read that functions can call its function to solve the sub problems. The course note about Koch fractal gave me an example and I felt like great example. It explains that 3 koch fractal is consist of four 2 koch fractals and 2 koch fractal is also consist of four 1 koch fractals, and so on. So basically it is doing same drawing pattern in each fractals. This "drawing pattern" will be a function as in programming, so it is calling self multiple times. I thought that it is similar to calculating the nested list.
I feel like tracing the functions just need a lot of practices. The lab 3 had a lot of problems, so it would be an great ways to review and get comfortable with it. Soon we might start coding the recursive function, so getting used to tracing it would make writing process easier.
No comments:
Post a Comment