Applied Python Algorithms:
WE USED PYTHON TO DO:
-
Start of Course Python Tricks for famous problems:
Iteration, Cube Roots, Binary to Decimal, Bisection
Search, Newton Raphson Method, Square Roots, Iterative
Power, X to the Power N, Understanding Root Finding,
Area and Circumference of a Circle, Recursive verses
Iterative Algorithms, Fibonacci, Factorial,
Palindrome, Multiply, Towesr of Hanoi, Functions as
Parameters, Common Divisors, Duplicate Removal Lists,
Lists of Lists, List Reversal, Is It a Palimdrome?,
String to Int, Hash string, Dictionary with Int Keys
- Financial
Calculations in Python Example : Financial calculations
demonstrating various speeds of paying off debt
-
Algorithms for guessing, root finding, and using Python
to write hang man and scrabble games : Successive
Approximation Method, Newton Raphson Method
of Finding Roots of Polynomial Functions, and the Hang
Man and Word Find Games in PythonHang Man and
Word Find Games programmed in Python.
-
Caesar Cipher Encryption and Decryption Code and
Secret Messages, along with Code to detect specific
strings in other strings using only indexing, slicing,
concatenation with a recursive function and no loops,
and also, code to emulate and old fashioned type
writer : Exercises in Python.
- Parsing web pages
such as Yahoo and Google to create triggers when
certain phrases were found within the web pages :
We built a Python program to monitor and filter news
feeds over the internet.
-
Used a graphic of a tiled floor and various types of
Python made robots to demonstrate how best and
efficiently it could be cleaned by these :
Exercises In Python.
-
Stochastic
Simulation of Patient Virus Population Dynamics And
Treatment Regimens: cases where you have a number of
diseased cells, antibiotics, resistances to
antibiotics, and a percentage you need to
achieve to remove the illness, and calculation to
compare using and not using a drug for it :
Exercises In Python.
-
Stochastic Simulation of Patient Virus Population
Dynamics: Effect of Delaying Drug Treatment on Patient
Disease, Using 2 Drugs, and Patient non-Compliance :
Exercises In Python.
-
Brute Force Search, a variation of the Depth First
Search, on a map of the MIT campus minimizing time
outdoors :
Exercises In Python.
-
Breadth First Search Search, Depth First Search,
Puzzles, Max Clique Subgraphs, Tree and Graph Algorithms, and Power Sets :
Exercises in tree data search efficiency and
optmization in Python. We explored graphs to
find paths that represent physical networks. They are used for
communication networks, circuits, genes, social networks,
disease populations, etc.
-
Optimization Problems and Dynamic Programming :
fitting data to linear and quadratic curves, normal
distributions, measuring goodness of fit of data to a
curve, uniform distributions, estimating Pi, Monty
Hall Problems, number of samples needed for a coin
flip experiment, variance and standard deviation,
plotted histograms, causal and predictive
nondeterminism, stochastic processes, monte carlo
simulations, hash tables, random walks and simulation
models, examined different algorithms for searching
and sorting and their Big O Notation performances.
This lecture example Python code
demonstrated
code optimization.
You start with an objective function and a set of
constraints the solution must satisfy. Examples were
the n-queens problem, where you place n-queens on an NxN
board so that no 2 queens
attack each other (no 2 queens share the same row, column
or diagonal). Other examples were bin packing, cutting
stock and min cut networks and the traveling salesmen
problem. The challenge shown was that these problems are
"hard" to solve. Often finding optimal solutions requires
examining all possible combinations of items. The time to
examine all combinations grows exponentially with the
number of items. "Real World" problems have a large
number of items. Dynamic
Programming
: The dynamic programming using
optimal substructure and overlapping subproblems. In the
Fibonacci example the memoize function was used to
demonstrate using function arguments as a sequence, which
works for immutable / hashable arguments. The memoize
function remembers previously computed answers, much like
a cache does in hardware.