You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
defrecur(intlevel,intparam):
# teminatoriflevel>MAX_LEVEL {
return
}
# process current levelprocess(level,parm)
# drill downrecur(level:level+1,newParam)
# restore current status
分治代码模板
defdivide_conquer(problem,param1,param2,...):
# recursion teminatorifproblemisNone:
print_resultreturn# prepare datadata=prepare_data(problem)
# conquer subproblemssubresult1=self.divide_conquer(subproblems[0],p1,...)
subresult2=self.divide_conquer(subproblems[1],p1,...)
subresult3=self.divide_conquer(subproblems[2],p1,...)
# process and genreate the final resultresult=process_result(subresult1,subresult2,subresult3)
# revert the current level states
Activity