CSC_349_HANDOUT#13

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

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

View Full Document Right Arrow Icon
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
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/10/2011 for the course CSC 349 taught by Professor Oadje during the Spring '11 term at University of Victoria.

Page1 / 3

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

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online