Pseudo-polynomial Algorithms Last Updated : 22 Aug, 2021 Comments Improve Suggest changes Like Article Like 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) Comment More infoAdvertise with us Next Article Pseudo-polynomial Algorithms D Dheeraj Gupta Improve Article Tags : Analysis of Algorithms DSA knapsack Similar Reads Sgn value of a polynomial Given a polynomial function f(x) = 1+ a1*x + a2*(x^2) + ... an(x^n). Find the Sgn value of these function, when x is given and all the coefficients also. If value of polynomial greater than 0 Sign = 1 Else If value of polynomial less than 0 Sign = -1 Else if value of polynomial is 0 Sign = 0 Example 6 min read Polynomial Time Approximation Scheme It is a very well known fact that there is no known polynomial time solution for NP Complete problems and these problems occur a lot in real world (See this, this and this for example). So there must be a way to handle them. We have seen algorithms to these problems which are p approximate (For exam 4 min read Horner's Method for Polynomial Evaluation Given a polynomial of the form cnxn + cn-1xn-1 + cn-2xn-2 + ... + c1x + c0 and a value of x, find the value of polynomial for a given value of x. Here cn, cn-1, .. are integers (may be negative) and n is a positive integer.Input is in the form of an array say poly[] where poly[0] represents coeffici 6 min read Finding nth term of any Polynomial Sequence Given a few terms of a sequence, we are often asked to find the expression for the nth term of this sequence. While there is a multitude of ways to do this, In this article, we discuss an algorithmic approach which will give the correct answer for any polynomial expression. Note that this method fai 4 min read Complete the sequence generated by a polynomial Given a sequence with some of its term, we need to calculate next K term of this sequence. It is given that sequence is generated by some polynomial, however complex that polynomial can be. Notice polynomial is an expression of the following form: P(x) = a0 + a1 x +a2 x^2 + a3 x^3 â¦â¦.. + an x^nThe g 10 min read Program to add two polynomials Given two polynomials represented by two arrays, write a function that adds given two polynomials. Example: Input: A[] = {5, 0, 10, 6} B[] = {1, 2, 4} Output: sum[] = {6, 2, 14, 6} The first input array represents "5 + 0x^1 + 10x^2 + 6x^3" The second array represents "1 + 2x^1 + 4x^2" And Output is 15+ min read Preparata Algorithm Preparata's algorithm is a recursive Divide and Conquer Algorithm where the rank of each input key is computed and the keys are outputted according to their ranks. C++ m[i, j] := M[i, j] for 1 <= i, j <= n in parallel; for r : = 1 to logn do { Step 1. In parallel set q[i, j, k] := m[i, j] + m[ 14 min read Adding two polynomials using Linked List Given two polynomial numbers represented by a linked list. The task is to add these lists meaning the coefficients with the same variable powers will be added.Note: Given polynomials are sorted in decreasing order of power.Example: Input: head1: [[5, 2], [4, 1], [2, 0]]head2: [[5, 1], [5, 0]]Output: 15+ min read Adding two polynomials using Linked List using map Given two polynomial numbers represented by a linked list. Write a function to perform their algebraic sum. Examples: Input: 1st number = 5x^2 + 4x^1 + 2x^0 2nd number = 5x^1 + 5x^0 Output: 5x^2 + 9x^1 + 7x^0 Approach: The implementation uses map data structure so that all coefficients of same power 10 min read Minimize the sum of roots of a given polynomial Given an array whose elements represent the coefficients of a polynomial of degree n, if the polynomial has a degree n then the array will have n+1 elements (one extra for the constant of a polynomial). Swap some elements of the array and print the resulting array such that the sum of the roots of t 15+ min read Like