{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

CSC_349_HANDOUT#13

# CSC_349_HANDOUT#13 - COMPUTER SCIENCE 349A Handout Number...

This preview shows pages 1–2. Sign up to view the full content.

1 COMPUTER SCIENCE 349A Handout Number 13 HORNER’S ALGORITHM (NESTED MULTIPLICATION, SYNTHETIC DIVISION) Given a polynomial = = n i i i x a x f 0 ) ( and a value 0 x , this algorithm is used to efficiently evaluate ) ( and ) ( 0 0 x f x f . To illustrate the basic idea, consider the case 4 = n : (1) 4 4 3 3 2 2 1 0 ) ( x a x a x a x a a x f + + + + = can be rewritten in the form (2) ))) ( ( ( ) ( 4 3 2 1 0 a x a x a x a x a x f × + × + × + × + = . Evaluation of (1) at x 0 requires 7 multiplications and 4 additions, whereas (2) requires only 4 multiplications and 4 additions. The general case (for a polynomial of order n ): form (1) requires 1 2 n multiplications and n additions, form (2) requires n multiplications and n additions. An algorithm to evaluate ) ( 0 x f , assuming that = = n i i i x a x f 0 ) ( is written in the “nested” form , as in (2): 0 , 1 , , 2 , 1 for compute Then . Let 0 1 0 1 0 0 0 1 2 2 0 1 1 K M = + = + = + = + = = + n n k x b a b x b a b x b a b x b a b a b k k k n n n n n n n n Then ) ( 0 0 x f b = .

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern