At this point in CSC148, I would like to reflect on how my thoughts about
the topic of recursion have changed and developed from week 7. When I first
learned about recursion, the idea of a function calling
itself again was very interesting. I got the impression that if the solution of
a smaller part of a function can be found using the same algorithm as the
original problem, it is always convenient to use recursion to break up the
problem into smaller pieces. Therefore, when I implemented codes for trees,
binary trees and binary search trees in class, I always used recursion to
simplify the problem since we only dealt with small data structures. However,
while working on assignment two, the implementation of depth_first_solve and
breadth_first_solve in puzzle tools changed some of my thoughts.
When I first
read about Professor Heap’s guidelines for implementing these functions, I
thought that keeping track of visited nodes would be an effective idea, but I
also thought that the program would still run normally without any problem
although it might take longer even if I did not implement this part. However,
since the assignment deals with big data structures and too much repetitive
data is stored in the memory, I came across a memory run-out problem.
Therefore, I decided to implement visited_nodes to keep track of all of the
nodes that I have already visited. However, I was still experiencing memory
run-out because of the number of nodes in the data structure and numerous
levels to check. I learned that it is important not only to control the total
number of recursive calls but also to minimize the maximum depth of recursive
calls to fix this memory run-out problem.
Through this
assignment, I realized that recursion is a very useful and convenient skill,
but in real life situations when the total data size is huge, time complexity
and memory management are as important as the algorithm itself. As we have started
to learn about time complexity in class this week, I think it will be very
useful in writing more time effective programs. Also, with curiosity, I
searched more about memory management and time complexity and found out there
is a concept called space complexity. Space complexity is a way to measure how
much storage an algorithm needs. I think I will learn more about it in advanced
courses. I hope that in the future I can become a developer who can design a software
with not only great coding style and algorithm, but also great time and space
management.
No comments:
Post a Comment