Electronic Transactions on Numerical Analysis
its book of mathematics on numerical analysis.
9 Shortest Paths
A fundamental problem in graphs is finding the shortest path from vertex A to vertex B.
Fortunately there are several simple (and efficient algorithms for doing this). We will look at
the three best of these: Dijkstra’s algorithm, Floyd’s algorithm, and the Bellman-Ford algorithm.
First we need to discuss different types of shortest path problems and various conventions that
we will use in solving them.
10 Euclidean Algorithm
Number theory is the mathematics of integer arithmetic. In this chapter we will restrict
ourselves to integers,
11 Division Mod n
Let's look at the values of 4x + 6y when x and y are integers. If x is -6 and y is 4 we get
zero. If x is !1 and y is 1 we get 2. In fact a little experimentation will convince you that you
can get all the even integers but only even integers.
12 Chinese Remainder Theorem
Many classroom exercises involve dealing cards. In this chapter we will focus on a
simple problem: Write an algorithm to randomly select one card out of an ordinary 52-card deck.
My students frequently derive an efficient algorithm to solve this problem. The algorithm goes
as follows we use a random number generator to select a number between 1 and 52 (or between
0 and 51; either way works fine).
13 Euler's Theorem and Fermat's Little Theorem
The formulas of this section are the most sophisticated number theory results in this
book. The reason I am presenting them is that by use of graph theory we can understand them
easily. Fermat was a great mathematician of the 17th century and Euler was a great
mathematician of the 18th century.
14 Wilson's Theorem
Wilson’s Theorem is elegant. It is not very useful, but like a lot of other people, I like
it. So that is why it is here. Consider an integer n > 1. If the integer n-1! + 1 is divided by any
number from 2 to n-1, it yields a remainder of 1.
Let us examine a real-life problem. As a university professor I feel that teaching twenty
students for one hour a week is too much of a demand on my time and that it cuts into my
research (on sour mash). Therefore, in order to cut back on my teaching load in future classes,
I have decided to flunk most of my students this semester. Specifically, I am going to give one
A, one B, one C, one D, and I'll flunk everyone else.
Let us slightly generalize the problem of selecting r out of n objects without respect to
order. Suppose, for example, that I have 20 students.
17 Stirling Numbers of the Second Type
Again: a partition of n objects is a division of these objects into separate classes. Each
object must be in one and only one class and partitions with empty classes are not allowed.
8 Horner's Algorithm - Free eBook 8 Horner's Algorithm - Download ebook 8 Horner's Algorithm free