|
Orbital library | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object orbital.algorithm.template.DivideAndConquer
public class DivideAndConquer
Framework (template class) for Divide and Conquer Algorithms.
top-down technique
DivideAndConquerProblem
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface orbital.algorithm.template.AlgorithmicTemplate |
---|
AlgorithmicTemplate.Configuration |
Constructor Summary | |
---|---|
DivideAndConquer()
|
Method Summary | |
---|---|
Function |
complexity()
≈O(n*㏒ n). |
java.lang.Object |
solve(AlgorithmicProblem p)
Generic solve method for a given algorithmic problem. |
java.lang.Object |
solve(DivideAndConquerProblem p)
solves by divide and conquer. |
Function |
spaceComplexity()
Measure for the asymptotic space complexity of the central solution operation in O-notation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DivideAndConquer()
Method Detail |
---|
public java.lang.Object solve(AlgorithmicProblem p)
AlgorithmicTemplate
solve
in interface AlgorithmicTemplate
p
- algorithmic problem hook class which must fit the concrete
algorithmic template framework implementation.
Function.apply(Object)
public java.lang.Object solve(DivideAndConquerProblem p)
public Function complexity()
More precisely, if you have a recurrence T(n) that describes the running time of a divide and conquer algorithm that divides a problem of size n into p subproblems of size n/d, each, and the cost of dividing and merging a problem of size n is f(n), you can apply the master theorem to find an precise asymptotic bound for the running time T(n).
T(n) ∈ | { | Θ(n㏒dp) | ⇐ ∃ε>0 f(n)∈O(n㏒dp-ε) |
Θ(n㏒dp⋅㏒n) | ⇐ f(n)∈Θ(n㏒dp) | ||
Θ(f(n)) | ⇐ ∃ε>0 f(n)∈Ω(n㏒dp+ε)
∧ ∃c<1 p⋅f([n/d]) ≤ c⋅f(n) p.t. n∈N |
complexity
in interface AlgorithmicTemplate
AlgorithmicTemplate.solve(AlgorithmicProblem)
public Function spaceComplexity()
AlgorithmicTemplate
spaceComplexity
in interface AlgorithmicTemplate
AlgorithmicTemplate.solve(AlgorithmicProblem)
|
Orbital library 1.3.0: 11 Apr 2009 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |