What is a pseudo-polynomial?
When the worst time complexity of an algorithm is based on the order of magnitude of the input, we call the algorithm's time complexity even pseudo polynomial time (the interpretation on a wiki may be better understood if the time complexity of a numerical algorithm can be expressed as a polynomial of the input numerical scale n, But its running time and the bits number of input numerical scale n are exponential growth, it is called the time complexity of pseudo polynomial time . This is because the value of n is the power of the number of bits of n, so the time complexity of the algorithm should actually be considered as the power from Wiki of the number of bits of the input number n.
For example: counts the frequency of occurrences of all positive numbers in an array. The algorithm finds the maximum number Max and then iterates from 1 to Max to find out how often this number appears in the array. The time required for this algorithm depends on the size of the largest number in the array, so the algorithm is pseudo polynomial time. In other words, the time complexity of an algorithm is only based on the number of input elements, we think the algorithm is a polynomial time algorithm.
Pseudo-polynomial and NP-complete problems
Some NP problems are the solution of pseudo polynomial time, such as: 0-1 knapsack problem Dynamic programming solution, subset and problem (find out the problem of subset in array and equal to some value), slicing problem. This is all pseudo polynomial time. If a NP-complete problem has a pseudo polynomial-time solution, then we call this problem weak NP-complete problem.
Original link:
http://www.geeksforgeeks.org/pseudo-polynomial-in-algorithms/
Translation:
Rui
Pseudo-polynomial-time algorithm pseudo-polynomial algorithms-----geeksforgeek Translation