Data Structures and Algorithms - Design Techniques

41. Consider the polynominal p(x) = a0 + a1x + a2x2 + a3x3, where a1 ≠ 0, ∀i. The minimum number of multiplcations needed to evaluate p on an input x is

  • Option : A
  • Explanation :
    p(x) = a0 + a1x + a2x2 + a3x3
    p(x) = a0 + (Ca3x + a2)x + a)x
    t = cl3* x
    t = t + a2
    t = t * x
    t = t + a1
    t = t * x
    t = t + a0
    So minimum 3 multiplication are needed to e valuate P.
Cancel reply
Cancel reply

45. Which of the following statement(s) is/are correct regarding Bellman-Ford shortest path algorithm?
P. Alvvays finds a negative weighted cycle, if one exists.
Q. Finds whether any negative weighted cycle is reachable from the source

  • Option : B
  • Explanation :
    I n Bellman Ford shortest path algorithm, we choose a node first and then we find any negative weighted cycle is reachable from source.
Cancel reply
Cancel reply