The outline of today's class is still in draft form.
Graph data structure.
Computer Science is the study of algorithms, including their (1) formal and mathematical properties, (2) hardware realizations, (3) linguistic realizations, and (4) applications.
getChopSticks()
and related functions for the following ...
public class Philosopher() {
public exist() {
while (!dead) {
think();
getChopSticks();
eat();
dropChopSticks();
} // while still alive
} // exist
} // philosopher
getChopSticks() simply picks up left then right,
you may run into a problem if all philosophers get hungry at the same
time. Each picks up the left chopstick and then waits until the
right chopstick becomes available.
square(x) = x*x
square(2+3) by ...
2+3 (getting 5), then replacing
square(5) by 5*5, then replacing
5*5 by 25.
square(2+3) by (2+3)*(2+3),
then evaluating each of the (2+3)'s, then replacing
5*5 by 25.
fact(n) = if(n==0, 1, n*fact(n-1))
if() is also a function.
if might be defined as
if(true,T,F) = T if(false,T,F) = F
fact(1) ...
fact(1) -> if(1==0, 1, 1*fact(1-1)) -> if(false, 1, 1*fact(1-1)) -> if(false, 1, 1*fact(0)) -> if(false, 1, 1*if(0==0, 1, 0*fact(0-1))) -> if(false, 1, 1*if(true, 1, 0*fact(-1))) -> if(false, 1, 1*if(true, 1, 0*if(-1==0, 1, -1*fact(-1-1)))) -> ...
Disclaimer Often, these pages were created "on the fly" with little, if any, proofreading. Any or all of the information on the pages may be incorrect. Please contact me if you notice errors.
Source text last modified Tue Dec 9 10:48:45 1997.
This page generated on Tue Dec 9 10:51:21 1997 by SiteWeaver.
Contact our webmaster at rebelsky@math.grin.edu