CSE
1400
Applied Discrete Mathematics
Algorithms
Department of Computer Sciences
College of Engineering
Florida Tech
Spring
2011
1
Algorithms
1
1
.
1
Horner’s Rule
1
1
.
2
Basic Sums
2
Abstract
There are many algorithms useful in computing.
1
Algorithms
1
.
1
Horner’s Rule
Consider the problem of computing the value of the polynomial
p
(
x
) =
5
x
3
+
4
x
2
+
7
x
+
2
at
x
=
3. This computation can be organized in several ways, one of
which is called
Horner
. Horner’s rule computes the value
p
(
3
) =
2
+
3
·
(
7
+
3
·
(
4
+
3
·
5
))
(
1
)
Which is the action of the recursive function
+ x
*
(horner x
s) on
the constant
x
=
3 and the list
(
a
:
as
) =
h
2, 7, 4, 5
i
of coefﬁcients
whose
head
is
a
=
2 and whose
tail
is
as
=
h
7, 4, 5
i
The polynomial coefﬁcients in
p
(
x
) =
5
x
3
+
4
x
2
+
7
x
+
2 can be written in two
orders
1
.
Little Endian, that is,
h
2, 7, 4, 5
i
or
2
.
Big Endian, that is,
h
5, 4, 7, 2
i
In the example, Horner’s rule requires 3 multiplies and 3 additions
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.
 Fall '11
 Shoaff
 Math

Click to edit the document details