Open In App

Pseudo-polynomial Algorithms

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Share
Report issue
Report

What is a pseudo-polynomial algorithm? 
A pseudo-polynomial algorithm is an algorithm whose worst-case time complexity is polynomial in the numeric value of input (not number of inputs).
For example, consider the problem of counting frequencies of all elements in an array of positive numbers. A pseudo-polynomial time solution for this is to first find the maximum value, then iterate from 1 to maximum value and for each value, find its frequency in array. This solution requires time according to maximum value in input array, therefore pseudo-polynomial. On the other hand, an algorithm whose time complexity is polynomial in the number of elements in array (not value) is considered as polynomial time algorithm. 

Pseudo-polynomial and NP-Completeness 
Some NP-Complete problems have pseudo-polynomial time solutions. For example, Dynamic Programming Solutions of 0-1 Knapsack, Subset-Sum and Partition problems are Pseudo-Polynomial. NP complete problems that can be solved using a pseudo-polynomial time algorithms are called weakly NP-complete. 

Reference: 
https://en.wikipedia.org/wiki/Pseudo-polynomial_time 

StackOverflow – What is pseudopolynomial time? How does it differ from polynomial time? (top answer) 

 

 


Last Updated : 22 Aug, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads