Introduction to Algorithms
© Copyright 2012 Herbert J. Bernstein
Algorithms, Programming and Programming Languages
- What are algorithms? What are programs?
- Originally (see the O.E.D):
- Algorithm: specific step-by-step method of numeric calculation
- Program: plan of action, again usually step-by-step, but usually intended to connote something
more general than a specific algorithm.
- Now the two terms have swapped roles:
- Algorithm: plan of action, again usually step-by-step, but usually intended to connote
something more general than a specific program. Usually written in words, diagrams and equations.
- Program: specific step-by-step method of numeric calculation. Written as a specific
set of lines of code in a particular programming language
- See http://en.wikipedia.org/wiki/Algorithm#Computer_algorithms
- See http://en.wikipedia.org/wiki/Programming_language
- See http://www.bernstein-plus-sons.com/.dowling/Prog_Lang_Module/Prog_Lang_Intro.html.
- If we don't have a specific program, what can we say about an algorithm?
- Where do you find algorithms and how much time and space they use:
- Donald Knuth, "The Art of Computer
Programming" V1-4, 3rd ed., Boxed set, Pearson, 2011, ISBN 9780321751041.
- Numerical Recipes, the Art of Scientific Comouting, http://www.nr.com/
- The libraries provided with your favorite language
- and a semi-infinite number of web sites you can find with google.
- Important algorithms
- Stacks, heaps, queues, lists, trees, hash tables and graphs. (See
http://www.wikipedia.org/wiki/Data_structure).
For an example of a java listnode class, see ListNode.java
and as a test driver
MergeList.java
For a similar problem in C, see
mergel.c and
mergel.h
For examples of stacks see
ListStack.java,
TestListStack.java,
VectorStack.java,
TestVectorStack.java
- Random Numbers
- Lists
- Trees and Graphs
See www.jgrapht.org
See mathworld.wolfram.com/Graph.html
- Searching and sorting
- Sorting
- Searching