mirror of
https://hub.njuu.cf/TheAlgorithms/C-Plus-Plus.git
synced 2023-10-11 13:05:55 +08:00
Update dynamic_programming/partition_problem.cpp
Co-authored-by: David Leal <halfpacho@gmail.com>
This commit is contained in:
parent
519390b1b8
commit
d830017be3
@ -4,12 +4,12 @@
|
||||
*Problem](https://en.wikipedia.org/wiki/Partition_problem )
|
||||
* @details
|
||||
* The partition problem, or number partitioning, is the task of deciding
|
||||
*whether a given multiset S of positive integers can be partitioned into two
|
||||
*subsets S1 and S2 such that the sum of the numbers in S1 equals the sum of the
|
||||
*numbers in S2. Although the partition problem is NP-complete, there is a
|
||||
*pseudo-polynomial time dynamic programming solution, and there are heuristics
|
||||
*that solve the problem in many instances, either optimally or approximately.
|
||||
*For this reason, it has been called "the easiest hard problem".
|
||||
* whether a given multiset S of positive integers can be partitioned into two
|
||||
* subsets S1 and S2 such that the sum of the numbers in S1 equals the sum of the
|
||||
* numbers in S2. Although the partition problem is NP-complete, there is a
|
||||
* pseudo-polynomial time dynamic programming solution, and there are heuristics
|
||||
* that solve the problem in many instances, either optimally or approximately.
|
||||
* For this reason, it has been called "the easiest hard problem".
|
||||
*
|
||||
* The worst case time complexity of Jarvis’s Algorithm is O(n^2). Using
|
||||
* Graham’s scan algorithm, we can find Convex Hull in O(nLogn) time.
|
||||
|
Loading…
Reference in New Issue
Block a user