正在加载图片...
上海交通大学交大密西根 联合学院·一 ◆ UM-SJTU Joint Institute University of Michigan Shanghal Jiao Tong University Conditions of Using Recursion Strategy The two essential conditions void printStr (string str) in which recursion can be ConsoleT console; used are You must be able to if (Istr.empty ( identify the simple cases for { which the answer is easily console.printLine(str[0],endl); determined. printstr(str.substr (1,str.length () } You must be able to identify a recursive decomposition that allows This is a simpler problem and you to break any complex instance of the problem it has the same form and into simpler problems of it will converge at finite steps of the same form. iterations.Conditions of Using Recursion Strategy Conditions of Using Recursion Strategy • The two essential conditions in which recursion can be used are : – You must be able to identify the simple cases for which the answer is easily determined. – You must be able to identify a recursive decomposition that allows you to break any complex instance of the problem into simpler problems of the same form. • This is a simpler problem and • it has the same form and • it will converge at finite steps of iterations
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有