let res = [] recursion(level,param1,param2) return res
functionrecursion(level, param1, param2){ // 1. terminator 终止条件 if(level > max_level){ process_result return } // 2. process logic in current level 处理当前层逻辑 process(level,data) // 3. dirll down 进入下一层 recursion(level+1,param1,param2) // 4. reverse the current level status if needed 清理当前层状态 }