Wednesday, 19 February 2014

Recursion

   In past few weeks' study ,we've learnt that the conception of the recursion,as I wrote before,ttp://tmaftbbwaatmm.blogspot.ca/2014/02/first-impression-about-recursion.html the first impression about recursion.
   However, when we learnt how to express recursion by trees, which was more obvious and more complicate than list expression, I found that the my first impression was not so accurate.
   For list impression, recursion is like to repeat the same operation from biggest to smaller unit.It looks like a linear structure,starts from a known point and ends at a fixed destination where there is no smaller unit to run.Writing list recursion might be efficient to avoid duplicate code. But for some common and easy cases, I couldn't see apparent advantages to use the recursion expression.
  When it comes to the trees structure, the superiority of recursion grows clearly.A typical binary tree structure is made up by nodes.Top of the tree is called root and others are called branches.The group of branch nodes with the same reference is called the leaf. By expressing in this way, we can adjust only a leaf of the tree or the root of the tree.I think, which is opposite from the lists, trees starts from the same root by ends at the different endpoints. That leads many different paths while running a program. Still, the operations keeps going to the smaller levels, that's the foundation of recursion. But there is no doubt that the tree structure fits the complexes better.

No comments:

Post a Comment