분할정복 template

Type divide_and_conquer( S ) {
    // (1). Divide the problem into a set of subproblems.
    [S1, S2, ... Sn] = divide(S)

    // (2). Solve the subproblem recursively,
    //   obtain the results of subproblems as [R1, R2... Rn].
    rets = [divide_and_conquer(Si) for Si in [S1, S2, ... Sn]]
    [R1, R2,... Rn] = rets

    // (3). combine the results from the subproblems.
    //   and return the combined result.
    return combine([R1, R2,... Rn])

}

 

+ Recent posts