======================================================================
This file is a compilation of messages which were published to the
ucd.class.ecs122a newsgroup (Spring 1996)
======================================================================




From news.ucdavis.edu!toadflax!blackj Thu Dec 12 10:37:27 1996
Path: news.ucdavis.edu!toadflax!blackj
From: blackj@toadflax.cs.ucdavis.edu (John R. Black)
Newsgroups: ucd.class.ecs122a
Subject: Additional Optional Discussion
Date: 8 Oct 1996 04:07:07 GMT
Organization: University of California, Davis
Lines: 24
Message-ID: <53ck1b$pnf@mark.ucdavis.edu>
NNTP-Posting-Host: toadflax.cs.ucdavis.edu
X-Newsreader: TIN [version 1.2 PL1]

Several students have mentioned that the current optional discussions on 
Wednesdays 4-5pm does not fit their schedules.  I therefore plan to convert
one of my Thursday office hours into a second discussion; please vote for
the time which best fits your schedule.  If attendance is insufficient,
this may revert to an office hour, but it will remain at the new time.

Vote for some permutation of 1, 2, 3, 4, 5, in order of your preference
from highest to lowest:

1. Tuesday 3:10pm
2. Tuesday 4:10pm
3. Wednesday 5:10pm
4. Thursday 1:10pm
5. Thursday 2:10pm


Please vote only if you plan to attend.

Send your vote to blackj@cs by Friday, 10/11.  If there is sufficient interest,
the new discussion will begin meeting the week of 10/14, and my Thursday
office hours will be reduced from 2-4pm to 3-4pm.

John Black
TA 122A

>From news.ucdavis.edu!usenet Thu Dec 12 10:37:27 1996
Path: news.ucdavis.edu!usenet
From: Phil Rogaway <rogaway@cs.ucdavis.edu>
Newsgroups: ucd.class.ecs122a
Subject: homework clarification: problem 2-5
Date: Tue, 08 Oct 1996 14:01:04 -0700
Organization: University of California, Davis
Lines: 12
Message-ID: <325AC110.41C6@cs.ucdavis.edu>
NNTP-Posting-Host: rogaway.cs.ucdavis.edu
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.0 (X11; U; IRIX 5.3 IP22)

Problem 2-5:
 The number of flips is a worst-case bound.  This wasn't made clear
 in the problem's wording.

Your hardworking TA has bested my solution to this problem, using
a computer-assisted analysis.  After much hard work (by John and
his patient computer) he can make do with 2n-6 flips for n>=7.
Congradulations to John on the best pancake-flipping solution in 
UC history!


Phil Rogaway

>From news.ucdavis.edu!usenet Thu Dec 12 10:37:28 1996
Path: news.ucdavis.edu!usenet
From: Phil Rogaway <rogaway@cs.ucdavis.edu>
Newsgroups: ucd.class.ecs122a
Subject: possibly helpful book
Date: Tue, 08 Oct 1996 15:33:04 -0700
Organization: University of California, Davis
Lines: 8
Message-ID: <325AD6A0.446B@cs.ucdavis.edu>
NNTP-Posting-Host: rogaway.cs.ucdavis.edu
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.0 (X11; U; IRIX 5.3 IP22)

I've put a couple copies of
Sara Baase's book "Computer Algorithms: Introduction to
Design and Analysis" in Shields on 24-hour reserve.
Perhaps this book (which has sometimes been used in this class)
may be useful to some of you who might want to
consult some text in addition to CLR.

Phil Rogaway

>From news.ucdavis.edu!toadflax!blackj Thu Dec 12 10:37:28 1996
Path: news.ucdavis.edu!toadflax!blackj
From: blackj@toadflax.cs.ucdavis.edu (John R. Black)
Newsgroups: ucd.class.ecs122a
Subject: Error in PS2 solutions
Date: 11 Oct 1996 23:43:03 GMT
Organization: University of California, Davis
Lines: 6
Message-ID: <53mm27$i6u@mark.ucdavis.edu>
NNTP-Posting-Host: toadflax.cs.ucdavis.edu
X-Newsreader: TIN [version 1.2 PL1]

In problem 2-3 (the coin weighing problem) the final answer of log base 3
of n should have a ceiling symbol around it, not a floor.  Sorry about the
typo (my fault).

John Black
TA 122a

>From news.ucdavis.edu!usenet Thu Dec 12 10:37:28 1996
Path: news.ucdavis.edu!usenet
From: Phil Rogaway <rogaway@cs.ucdavis.edu>
Newsgroups: ucd.class.ecs122a
Subject: office hours
Date: Mon, 14 Oct 1996 17:04:33 -0700
Organization: University of California, Davis
Lines: 7
Message-ID: <3262D511.41C6@cs.ucdavis.edu>
NNTP-Posting-Host: rogaway.cs.ucdavis.edu
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.0 (X11; U; IRIX 5.3 IP22)

I have rescheduled my under-utilized office hours to:

   T 2-3, W 1:30 - 2:30.  

If you forget, it's on our Web page ...

Phil Rogaway

>From news.ucdavis.edu!usenet Thu Dec 12 10:37:28 1996
Path: news.ucdavis.edu!usenet
From: Phil Rogaway <rogaway@cs.ucdavis.edu>
Newsgroups: ucd.class.ecs122a
Subject: ps1 results
Date: Mon, 14 Oct 1996 17:32:42 -0700
Organization: University of California, Davis
Lines: 6
Message-ID: <3262DBAA.167E@cs.ucdavis.edu>
NNTP-Posting-Host: rogaway.cs.ucdavis.edu
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.0 (X11; U; IRIX 5.3 IP22)

A histogram for ps1 is on our Web page.
The file will grow to comprise histograms of
the other homeworks, mt, etc..


Phil Rogaway

>From news.ucdavis.edu!toadflax!blackj Thu Dec 12 10:37:29 1996
Path: news.ucdavis.edu!toadflax!blackj
From: blackj@toadflax.cs.ucdavis.edu (John R. Black)
Newsgroups: ucd.class.ecs122a
Subject: No other optional discussion
Date: 16 Oct 1996 03:11:06 GMT
Organization: University of California, Davis
Lines: 10
Message-ID: <541joa$7mn@mark.ucdavis.edu>
NNTP-Posting-Host: toadflax.cs.ucdavis.edu
X-Newsreader: TIN [version 1.2 PL1]

Due to underwhelming demand (only 3 people voted), there will not be an
additional option discussion section.  If you forgot to vote and you feel
strongly about it, impress upon me the urgency of your feelings (via email).

Otherwise, things will stay as they are.

john//

------------------------------------------------------
recursion (re ker' zhin), n.  1. see recursion

>From news.ucdavis.edu!usenet Thu Dec 12 10:37:29 1996
Path: news.ucdavis.edu!usenet
From: Phil Rogaway <rogaway@cs.ucdavis.edu>
Newsgroups: ucd.class.ecs122a
Subject: ps3 typos
Date: Wed, 16 Oct 1996 14:16:25 -0700
Organization: University of California, Davis
Lines: 6
Message-ID: <326550A8.2781@cs.ucdavis.edu>
NNTP-Posting-Host: rogaway.cs.ucdavis.edu
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.0 (X11; U; IRIX 5.3 IP22)

3-2.  Should read "T(n) <= c n"   (not "T(n) <= c lg n").

3-4. (a), (b):  The "T" should be an "S".
     (a).  Prove that the set T is NOT necessarilly unique.

A corrected version of ps3 has replaced the original on the Web.

>From news.ucdavis.edu!usenet Thu Dec 12 10:37:29 1996
Path: news.ucdavis.edu!usenet
From: Phil Rogaway <rogaway@cs.ucdavis.edu>
Newsgroups: ucd.class.ecs122a
Subject: lecture clarification
Date: Wed, 16 Oct 1996 16:48:12 -0700
Organization: University of California, Davis
Lines: 42
Message-ID: <3265743C.446B@cs.ucdavis.edu>
NNTP-Posting-Host: rogaway.cs.ucdavis.edu
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.0 (X11; U; IRIX 5.3 IP22)

A certain formula was less-than-clearly justified in class; let me try
again.

  ...............................................................
  Assume collision resolution by chaining and uniform hashing.
  What is the expected number of comparsions used to search for 
  a random item, ITEM, assuming this item to be IN the dictinary.
  ...............................................................

Observe:

  When the FIRST item was inserted into the dictionary the 
  length of its chain (ie., the chain it landed on) was 0.

  When the second item was inserted into the dictionary, the *expected*
  length of ITS (the chain it landed on) was 1/m.

  When the third item was inserted into the dictionary the expected
  length of its chain was 2/m.

  ...

  When the n-th item was inserted into the dictionary the expected
  length of its chain was (n-1)/m.


So: when a random one of these n items was inserted, the expected length 
  of its chain is just the average of 1/m, ..., (n-1)/m,  i.e.
  (1/n) [ 1/m + 2/m + ... + (n-1)/m ].     Now

  E[# of comparisions to serch for ITEM] 
         = 1 + E [length of the chain where ITEM was inserted 
                  at the time that ITEM was inserted]

                       n-1
                       ---   
         = 1 + (1/n)   \     (i/m)   .
                       /
                       ---
                       i=1

Then easy manipulation gives us that this is <= 1 + n/m - 1/2m.

>From news.ucdavis.edu!usenet Thu Dec 12 10:37:29 1996
Path: news.ucdavis.edu!usenet
From: Phil Rogaway <rogaway@cs.ucdavis.edu>
Newsgroups: ucd.class.ecs122a
Subject: selection recurrance
Date: Thu, 17 Oct 1996 00:58:21 -0700
Organization: University of California, Davis
Lines: 31
Message-ID: <3265E71D.794B@cs.ucdavis.edu>
NNTP-Posting-Host: rogaway.cs.ucdavis.edu
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.0 (X11; U; IRIX 5.3 IP22)

Here's the recurrance from lecture for our deterministic selection
algorithm, with a brief 
explanation of where each term comes from.  I'm ignoring "round off"
issues, just as I did in
class, and as you may on your homework problem relating to this.


T(n) =    6n/5             +    T(n/5)         +   
2n/5                         +    T(7n/10)
     To compute the           To recursively      To separate the
elements           To recursively
     medians of each          find the median     which are less than
the            do the selection 
     5-some, using the        of the medians      median-of-medians from
the         on the appropriate
     (claimed) algorithm                          elements which are
greater         side of the partitioned
     that finds the median                        than the
median-of-medians:        elements.  (This is
     of 5 elements using 6                        3n/10 elements are
*known*         a pessimistic count for
     comparisons                                  less than the
median-of-medians;   the size of the set that
                                                  3n/10 elements are
*known* greater    remains after removing
                                                  than the
median-of-medians; and the   one side of the 
                                                  remaining 2n/5
elements need to be    partitioned elemnts.)
                                                  compared to the
median-of-medians.

>From news.ucdavis.edu!toadflax!blackj Thu Dec 12 10:37:29 1996
Path: news.ucdavis.edu!toadflax!blackj
From: blackj@toadflax.cs.ucdavis.edu (John R. Black)
Newsgroups: ucd.class.ecs122a
Subject: Grade Reporting program available for ECS 122A
Date: 18 Oct 1996 02:46:37 GMT
Organization: University of California, Davis
Lines: 38
Message-ID: <546r2d$otu@mark.ucdavis.edu>
NNTP-Posting-Host: toadflax.cs.ucdavis.edu
X-Newsreader: TIN [version 1.2 PL1]

You can check your scores to-date at any time by sending mail to the
account "cs122at" with a subject of "scores".  There is a program on 
the other end which will reply within seconds and send you mail showing
all your scores to-date including problem sets, midterm, and final.

(Right now it's just PS1 of course.)

A score report looks like this:

-----------------------------------------
Report for: Black, John

Desc       Pts/Poss    Wt
------     --------  -----
PS1     =   23/40    ( 3%)

Weighted average is 57.50 percent
EC Pts: *

(Scores last updated: 1819 Oct 16)

----------------------------------------

Each line gives a description followed by the number of points you
received out of the number possible.  The weight (given in parentheses)
indicates how heavily this item is counted toward your overall average.
For the problem sets, there will be roughly 9 and as a group they
represent 30% of your grade, so each one is worth about 3.33%.

The "EC Pts" is extra credit points which are given out for special problems
(like PS1 problem 2(c)) or for especially nice answers to other problems.
EC pts are indicated by asterisks (1 per point earned).  

Please check your scores from time to time to make sure we are accurately
recording them.  If there is a descrepancy, bring your graded paper to my
attention and I will fix it.

John Black

>From news.ucdavis.edu!usenet Thu Dec 12 10:37:30 1996
Path: news.ucdavis.edu!usenet
From: Phil Rogaway <rogaway@cs.ucdavis.edu>
Newsgroups: ucd.class.ecs122a
Subject: deterministic selection
Date: Thu, 17 Oct 1996 19:50:13 -0700
Organization: University of California, Davis
Lines: 51
Message-ID: <3266F065.15FB@cs.ucdavis.edu>
NNTP-Posting-Host: rogaway.cs.ucdavis.edu
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.0 (X11; U; IRIX 5.3 IP22)

> From heinig@cs.ucdavis.edu  Thu Oct 17 18:29:49 1996
> Date: Thu, 17 Oct 1996 18:23:55 -0700 (PDT)
> From: Lael Heinig <heinig@cs.ucdavis.edu>
> To: rogaway@cs.ucdavis.edu
> Subject: Hw 3
> Mime-Version: 1.0
> Content-Type: TEXT/PLAIN; charset=US-ASCII
> 
> Professor Rogaway,
> 
>         A number of us have been confused on the amount of time for the 
> partition step of the Deterministic Selection problem.  John said that he 
> thinks it should take n/5 for 5 elements.  You have said that it takes 
> 2n/5.  If this is true would 3 elements take n/3; 7 elements take 3n/7 
> and so on.  Or would 3 elements take 2n/3; 7 elements take 2n/7 and so 
> on.  This is where the confusion lies.  Therefore we don't know what the 
> correct answers are to problem #1.  If you could shed some light on this 
> problem/step, we would appreciate it.
> 
> 
> Thank you,
> Lael Heinig


I had in class:

  T(n) = 6n/5  + T(n/5) + 2n/5 + T(7n/10).

The 2n/5 term was for the comparisons needed to partition the n 
elements on the median-of-the-medians (step 4 on p. 190 of the text).   
There are 3n/10 elements which are KNOWN smaller than the 
median-of-the-medians;  there are 3n/10 elements which are 
KNOWN larger than the median-of-the-medians; and that leaves
n - (3n/10 + 3n/10) = 2n/5 elements whose relation to the
median-of-medians is unknown.  These we should compare with the
median-of-medians to accomplish the partitioning.

I believe the n/5 term John was thinking about was to compare
the median of each column with the median-of-the medians -- ie to
rearrange our columns with the columns whose medians are less than
the median-of-medians on the left, and the columns whose medians are
greater than the median-of-medians on the right.  But actually we 
don't need to invest any new comparisons to accomplish this task:
in identifying the median-of-the-medians we will have necessarily
determined which columns had medians which are less than the 
median-of-medians and which columns had medians greater 
than the median-of-medians.   Else we couldn't have correctly
determined the median-of-medians.


-Phil Rogaway

>From news.ucdavis.edu!toadflax!blackj Thu Dec 12 10:37:30 1996
Path: news.ucdavis.edu!toadflax!blackj
From: blackj@toadflax.cs.ucdavis.edu (John R. Black)
Newsgroups: ucd.class.ecs122a
Subject: New Office Hours Schedule
Date: 20 Oct 1996 20:40:05 GMT
Organization: University of California, Davis
Lines: 14
Message-ID: <54e2n5$c3b@mark.ucdavis.edu>
NNTP-Posting-Host: toadflax.cs.ucdavis.edu
X-Newsreader: TIN [version 1.2 PL1]

A large number of students have complained that my only office hours are on
Thursdays, the day before the problems sets are due.  To better accommodate
those who begin earlier on the homework and need help earlier in the week,
I am moving one of my Thursday hours to Tuesday.  The remaining Thursday hour
is left skewed so that people with 1:40-3pm classes or 3:10-4:30pm classes
will still have access.

New Office Hours for TA:
	Tues	4:10 - 5pm
	Thurs	2:30 - 3:30pm

I hope this works out better for most of you.

John Black

>From news.ucdavis.edu!toadflax!blackj Thu Dec 12 10:37:30 1996
Path: news.ucdavis.edu!toadflax!blackj
From: blackj@toadflax.cs.ucdavis.edu (John R. Black)
Newsgroups: ucd.class.ecs122a
Subject: PS4
Date: 22 Oct 1996 01:03:44 GMT
Organization: University of California, Davis
Lines: 14
Message-ID: <54h6hg$ll5@mark.ucdavis.edu>
NNTP-Posting-Host: toadflax.cs.ucdavis.edu
X-Newsreader: TIN [version 1.2 PL1]

In attempt to better serve you, I've done all the homework that's due
Friday and I could find no typos, so have at it! :)

ADDITIONAL REQUIREMENT FOR 4-1:

Dr. Rogaway didn't give a maximum size for m (the hash table size); please
make sure your m is less than 200.  This shouldn't be too hard as there
are only 48 words so we're letting you use 4 times the space in the hash
table.  I was able to find LOTS of functions that worked.  

Your hash function should be "short and simple".  This means exactly what
you'd expect (it's just hard to describe what you expect). 

John

>From news.ucdavis.edu!usenet Thu Dec 12 10:37:30 1996
Path: news.ucdavis.edu!usenet
From: Phil Rogaway <rogaway@cs.ucdavis.edu>
Newsgroups: ucd.class.ecs122a
Subject: Problem 4-4 postponed
Date: Tue, 22 Oct 1996 19:02:00 -0700
Organization: University of California, Davis
Lines: 10
Message-ID: <326D7C98.41C6@cs.ucdavis.edu>
NNTP-Posting-Host: rogaway.cs.ucdavis.edu
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.0 (X11; U; IRIX 5.3 IP22)

I didn't get quite as far as I expected on Monday, and so you may still
be unclear on amortized analysis.  Thus I'll postpone Problem 4-4;  
please turn it in with next week's homework.

Hope that helps!


Phil Rogaway

 ps:   Happy hash hunting!

>From news.ucdavis.edu!toadflax!blackj Thu Dec 12 10:37:31 1996
Path: news.ucdavis.edu!toadflax!blackj
From: blackj@toadflax.cs.ucdavis.edu (John R. Black)
Newsgroups: ucd.class.ecs122a
Subject: Splay Tree Demo
Date: 29 Oct 1996 02:48:14 GMT
Organization: University of California, Davis
Lines: 10
Message-ID: <553r9e$eoi@mark.ucdavis.edu>
NNTP-Posting-Host: toadflax.cs.ucdavis.edu
X-Newsreader: TIN [version 1.2 PL1]

As we learn the wonderous ways of the splay tree you may want to 
supplement your intuition by playing with these things a little.  The
co-inventor of splay trees, Daniel Sleator, provides a demo on his
homepage.  Next time you're waiting for that long compilation to finish,
take a peek at

http://gs213.sp.cs.cmu.edu/cgi-bin/splay

John Black
(Serving you since 1996)

>From news.ucdavis.edu!usenet Thu Dec 12 10:37:31 1996
Path: news.ucdavis.edu!usenet
From: Phil Rogaway <rogaway@cs.ucdavis.edu>
Newsgroups: ucd.class.ecs122a
Subject: midterm - review session
Date: Wed, 30 Oct 1996 13:48:09 -0800
Organization: University of California, Davis
Lines: 2
Message-ID: <3277CD19.41C6@cs.ucdavis.edu>
NNTP-Posting-Host: rogaway.cs.ucdavis.edu
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.0 (X11; U; IRIX 5.3 IP22)

Review session - Wed, Nov 6, 6-8 pm, 1120 Bainer
Midterm        - Fri, Nov 8, in class

>From news.ucdavis.edu!usenet Thu Dec 12 10:37:31 1996
Path: news.ucdavis.edu!usenet
From: Phil Rogaway <rogaway@cs.ucdavis.edu>
Newsgroups: ucd.class.ecs122a
Subject: "sharing" homework solutions...
Date: Wed, 30 Oct 1996 14:15:38 -0800
Organization: University of California, Davis
Lines: 20
Message-ID: <3277D38A.167E@cs.ucdavis.edu>
NNTP-Posting-Host: rogaway.cs.ucdavis.edu
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.0 (X11; U; IRIX 5.3 IP22)

It's been brought to my attention that several students 
have turned in homeworks that are substantially identical.  

I would like to remind the entire class of the standard on 
academic misconduct wrt the homeworks:  

1. You must write up problems entirely on your own.    

2. You may *discuss* problems with your peers.  If you
   do this, you must acknowledge them.   "Discuss" means sharing a 
   general idea or approach -- it wouldn't entail doing a 
   write-up together or working out all details of a problem. 

On 2: I advise *against* working with anyone else on homework 
problems.  The process of individually struggling to solve a problem 
is an essential part of the learning experience for this class.  The 
midterm and final will in part be testing how well 
you've been acquiring problem-solving skills.

Phil Rogaway

>From news.ucdavis.edu!toadflax!blackj Thu Dec 12 10:37:32 1996
Path: news.ucdavis.edu!toadflax!blackj
From: blackj@toadflax.cs.ucdavis.edu (John R. Black)
Newsgroups: ucd.class.ecs122a
Subject: PS4 hash functions
Date: 5 Nov 1996 01:50:06 GMT
Organization: University of California, Davis
Lines: 17
Message-ID: <55m6ge$91p@mark.ucdavis.edu>
NNTP-Posting-Host: toadflax.cs.ucdavis.edu
X-Newsreader: TIN [version 1.2 PL1]

I am truly sorry it's taken so long to grade and return the last two 
problem sets.  Hopefully we'll do better in the last half of the quarter.

Most of you found good hash functions for PS4; however a few people submitted
hash functions that the grader could not get to work (in a few cases I
confirmed this).  If you have a star in the upper left corner of your 
graded homework, this means that your hash function didn't work when tested.
You were tentatively given 0 points for it.  But I assume there was simply
some unstated assumption you were making, or some oversight we are making
that is causing the confusion; so please clarify this in the next week or
so by any of the following means:

(1) Show me after class what you meant
(2) Come to office hours and explain
(3) Send me email (blackj@cs)

john//

>From news.ucdavis.edu!usenet Thu Dec 12 10:37:32 1996
Path: news.ucdavis.edu!usenet
From: Phil Rogaway <rogaway@cs.ucdavis.edu>
Newsgroups: ucd.class.ecs122a
Subject: ps5 solns; ps6 - part 1
Date: Tue, 05 Nov 1996 23:43:12 -0800
Organization: University of California, Davis
Lines: 3
Message-ID: <32804190.41C6@cs.ucdavis.edu>
NNTP-Posting-Host: rogaway.cs.ucdavis.edu
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.0 (X11; U; IRIX 5.3 IP22)

The subject material can be found on our course Web page....

-Phil Rogaway

>From news.ucdavis.edu!usenet Thu Dec 12 10:37:32 1996
Path: news.ucdavis.edu!usenet
From: Phil Rogaway <rogaway@cs.ucdavis.edu>
Newsgroups: ucd.class.ecs122a
Subject: revised ps5 solutions
Date: Wed, 06 Nov 1996 21:03:49 -0800
Organization: University of California, Davis
Lines: 3
Message-ID: <32816DB5.167E@cs.ucdavis.edu>
NNTP-Posting-Host: rogaway.cs.ucdavis.edu
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.0 (X11; U; IRIX 5.3 IP22)

A minor correction was made to 4-4(b) and a (simpler but
less efficient) solution was added to 5-3(a).
Grab the new-and-improved solutions off the Web!

>From news.ucdavis.edu!usenet Thu Dec 12 10:37:34 1996
Path: news.ucdavis.edu!usenet
From: Phil Rogaway <rogaway@cs.ucdavis.edu>
Newsgroups: ucd.class.ecs122a
Subject: midterm problems 2, 3.1 re-submission
Date: Mon, 11 Nov 1996 18:00:34 -0800
Organization: University of California, Davis
Lines: 38
Message-ID: <3287DA42.2781@cs.ucdavis.edu>
NNTP-Posting-Host: rogaway.cs.ucdavis.edu
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.0 (X11; U; IRIX 5.3 IP22)

In case anyone missed class today:

 Due in class on WEDNESDAY: a solution to problems 2 and 3.1 from the
MT.  
 For 2.2, you need only calculate the C_{i,j} values -- you needn't
compute 
 the routing. 

 Guidelines:

   -No Collaboration!
   -Maximum of 1 page for the two problems together (ie., half a page
per problem).

 Grading will probably be binary:  I'll decide if you got the problem or
you didn't.
 I do not guarantee to grade both problems (I might grade only a random
one).
 I will do the grading myself.  

 Doing the problems correctly now will not retroactively change your
midterm grade. 
 But I will record that you were able to do the problems in the absence
of time 
 pressure, and this may have a positive influence when your overall
grade is decided.



 I hope you enjoy getting the chance to put down what you would have
liked to have 
 written down on the midterm.  This isn't some sort of "punishment" -- I
just want 
 you to solve these problems and feel good about doing that.



Phil Rogaway

>From news.ucdavis.edu!usenet Thu Dec 12 10:37:34 1996
Path: news.ucdavis.edu!usenet
From: Phil Rogaway <rogaway@cs.ucdavis.edu>
Newsgroups: ucd.class.ecs122a
Subject: ps6 postponed until monday
Date: Mon, 11 Nov 1996 18:03:20 -0800
Organization: University of California, Davis
Lines: 5
Message-ID: <3287DAE8.446B@cs.ucdavis.edu>
NNTP-Posting-Host: rogaway.cs.ucdavis.edu
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.0 (X11; U; IRIX 5.3 IP22)

Because of the unexpected re-submission of the midterm questions,
I will postpone the due date of PS 6 to next Monday.  Hope that
helps,

Phil Rogaway

>From news.ucdavis.edu!toadflax!blackj Thu Dec 12 10:37:34 1996
Path: news.ucdavis.edu!toadflax!blackj
From: blackj@toadflax.cs.ucdavis.edu (John R. Black)
Newsgroups: ucd.class.ecs122a
Subject: Dynamic Programming problem
Date: 14 Nov 1996 23:59:09 GMT
Organization: University of California, Davis
Lines: 19
Message-ID: <56gbod$lnn@mark.ucdavis.edu>
NNTP-Posting-Host: toadflax.cs.ucdavis.edu
X-Newsreader: TIN [version 1.2 PL1]

Several people have requested a new DP problem which they could work out on
their own to try and firm-up their skills.  So I propose you do the
following problem, then come to discussion or office hrs next week and
we'll compare notes.

On the first day of class, Dr. Rogaway gave the following problem: given
only 4 coins with values 1, 3, 8, and 17, make change for n cents.  

Part I: Will a greedy alg work here?  If yes, prove it; if no, show a
	counterexample.

Part II: What is the minimizing expression for this problem (you can check
	your notes after you try to work it out on your own).

Part III: Code up a program that solves this problem.  If you want to check
	it out, write it in your favorite language and try it for various
	values of n.

john//

>From news.ucdavis.edu!matloff Thu Dec 12 10:37:34 1996
Path: news.ucdavis.edu!matloff
From: matloff@heather.cs.ucdavis.edu (Norm Matloff)
Newsgroups: ucd.class.ecs40,ucd.class.ecs110,ucd.class.ecs122a,ucd.class.ecs140a,ucd.class.ecs150,ucd.class.ecs154a
Subject: survey
Date: 16 Nov 1996 04:46:20 GMT
Organization: University of California, Davis
Lines: 20
Message-ID: <slrn58qhos.poj.matloff@heather.cs.ucdavis.edu>
Reply-To: matloff@cs.ucdavis.edu
NNTP-Posting-Host: heather.cs.ucdavis.edu
X-Newsreader: slrn (0.8.8.2 UNIX)
Xref: news.ucdavis.edu ucd.class.ecs40:684 ucd.class.ecs110:457 ucd.class.ecs122a:187 ucd.class.ecs140a:410 ucd.class.ecs150:478 ucd.class.ecs154a:280

If you are in any of the courses listed below THIS QUARTER, please send
me e-mail saying the average number of hours you spend outside of class
per week.  Again, this is an average, so please try to account for both
slack periods and busy periods.

Please E-MAIL me your response (matloff@cs).  The data (overall
averages, without names) will be used by our Undergraduate Affairs
Committee in discussing possible curricular changes.  Thanks very much!

Here are the courses of interest:

    ECS 40
    ECS 110
    ECS 122A
    ECS 140A
    ECS 150
    ECS 154A




>From news.ucdavis.edu!toadflax!blackj Thu Dec 12 10:37:34 1996
Path: news.ucdavis.edu!toadflax!blackj
From: blackj@toadflax.cs.ucdavis.edu (John R. Black)
Newsgroups: ucd.class.ecs122a
Subject: No TA off hrs this Thursday
Date: 18 Nov 1996 20:11:17 GMT
Organization: University of California, Davis
Lines: 12
Message-ID: <56qft5$kau@mark.ucdavis.edu>
NNTP-Posting-Host: toadflax.cs.ucdavis.edu
X-Newsreader: TIN [version 1.2 PL1]

I have my PhD preliminary exams for four afternoons starting Thursday, so
I won't make office hrs this Thursday.

Also, the following Tuesday (11/26) my exam ends at 4:30, so I will move
my office hrs from 4-5 to 5-6 (expect me to be slightly incoherent (yes,
more than usual)).

Also, I won't be as available for email questions during this period.  If
you need help on the homework, remember our lonely professor holding his
own office hours! :)

john//

>From news.ucdavis.edu!toadflax!blackj Thu Dec 12 10:37:34 1996
Path: news.ucdavis.edu!toadflax!blackj
From: blackj@toadflax.cs.ucdavis.edu (John R. Black)
Newsgroups: ucd.class.ecs122a
Subject: PS7 due date postponed
Date: 21 Nov 1996 02:49:02 GMT
Organization: University of California, Davis
Lines: 3
Message-ID: <570fuu$9ag@mark.ucdavis.edu>
NNTP-Posting-Host: toadflax.cs.ucdavis.edu
X-Newsreader: TIN [version 1.2 PL1]

PS7 is no longer due this Friday, but is instead due Monday, 11/25.

john//

>From news.ucdavis.edu!toadflax!blackj Thu Dec 12 10:37:35 1996
Path: news.ucdavis.edu!toadflax!blackj
From: blackj@toadflax.cs.ucdavis.edu (John R. Black)
Newsgroups: ucd.class.ecs122a
Subject: Reminder: do the DP example
Date: 25 Nov 1996 19:49:57 GMT
Organization: University of California, Davis
Lines: 8
Message-ID: <57ct95$rh1@mark.ucdavis.edu>
NNTP-Posting-Host: toadflax.cs.ucdavis.edu
X-Newsreader: TIN [version 1.2 PL1]

If you want to practice your dynamic programming skills, remember to do the
practice problem for this Wednesday's discussion (it's the coin-changing
problem with denominations 1, 3, 8, and 17).

I'll be posting my solution on the newsgroup as well, for those who cannot
attend.

john//

>From news.ucdavis.edu!usenet Thu Dec 12 10:37:35 1996
Path: news.ucdavis.edu!usenet
From: Phil Rogaway <rogaway@cs.ucdavis.edu>
Newsgroups: ucd.class.ecs122a
Subject: today's optional discussion
Date: Wed, 27 Nov 1996 10:56:48 -0800
Organization: University of California, Davis
Lines: 3
Message-ID: <329C8EF0.41C6@cs.ucdavis.edu>
NNTP-Posting-Host: rogaway.cs.ucdavis.edu
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.0 (X11; U; IRIX 5.3 IP22)

John will hold his usual discussion today, after class,
where he will discuss money, marriage, and other topics
of ecs122a.

>From news.ucdavis.edu!toadflax!blackj Thu Dec 12 10:37:35 1996
Path: news.ucdavis.edu!toadflax!blackj
From: blackj@toadflax.cs.ucdavis.edu (John R. Black)
Newsgroups: ucd.class.ecs122a
Subject: Using DP to solve the coin changing problem
Date: 28 Nov 1996 02:08:45 GMT
Organization: University of California, Davis
Lines: 88
Message-ID: <57is7d$jr7@mark.ucdavis.edu>
NNTP-Posting-Host: toadflax.cs.ucdavis.edu
X-Newsreader: TIN [version 1.2 PL1]

As mentioned today in lecture, if you're given coin denominations 1, 3, 8,
and 17, you need DP to solve the problem of finding the fewest # of coins
which sum to n.  (Greedy doesn't work: try n=24)

The minimizing expression (which Dr. Rogaway gave on the 1st day of class)
was

C(n) = 1 + min{C(n-1) + C(n-3) + C(n-8) + C(n-17)}

Turning this into a program was not too hard.  Try compiling and running
and toying with this if you like, but above all else, be sure you understand
the derivation:

#include <stdio.h>

#define		MAXVAL		1000

void c(int amt);

main(int argc, char **argv)
{
    int		amt = atoi(argv[1]);
    int		i;

    if (amt < MAXVAL)
	c(amt);
    else
	printf("amt %d is too large; limit is %d\n", amt, MAXVAL);
}

void c(int amt)
{
#define		PENNY		1
#define		THRENNY		3
#define		EIGHT		8
#define		SEVENTEEN	17

    int		A[MAXVAL];
    int		coinlink[MAXVAL];
    int		bsf, i, use;
    int		pennies, thrennies, eights, seventeens;

    /* bootstrap process at 0 */
    A[0] = 0; 

    for (i=1; i <= amt; i++)
    {
	bsf = 1 + A[i-1], use = PENNY;
	if ((i >= THRENNY) && (1 + A[i-THRENNY] < bsf))
	    bsf = 1 + A[i-THRENNY], use = THRENNY;
	if ((i >= EIGHT) && (1 + A[i-EIGHT] < bsf))
	    bsf = 1 + A[i-EIGHT], use = EIGHT;
	if ((i >= SEVENTEEN) && (1 + A[i-SEVENTEEN] < bsf))
	    bsf = 1 + A[i-SEVENTEEN], use = SEVENTEEN;
	A[i] = bsf;
	coinlink[i] = use;
    }

    printf("The best way to make change for %d cents is to use %d coins:\n",
	amt, A[amt]);

    while (amt)
    {
	switch (coinlink[amt])
	{
	  case PENNY: 	pennies++; amt -= PENNY; break;
	  case THRENNY: thrennies++; amt -= THRENNY; break;
	  case EIGHT: 	eights++; amt -= EIGHT; break;
	  case SEVENTEEN: seventeens++; amt -= SEVENTEEN; break;
	}
    }

    printf("%d Pennies\n", pennies);
    printf("%d Thrennies\n", thrennies);
    printf("%d 8 cent coins\n", eights);
    printf("%d 17 cent coins\n", seventeens);
}

Here is a sample run:

% cc change.c -o change
% change 49
The best way to make change for 49 cents is to use 5 coins:
0 Pennies
0 Thrennies
4 8 cent coins
1 17 cent coins
%

>From news.ucdavis.edu!toadflax!blackj Thu Dec 12 10:37:35 1996
Path: news.ucdavis.edu!toadflax!blackj
From: blackj@toadflax.cs.ucdavis.edu (John R. Black)
Newsgroups: ucd.class.ecs122a
Subject: Weights changed for Problem Sets
Date: 2 Dec 1996 02:16:02 GMT
Organization: University of California, Davis
Lines: 11
Message-ID: <57te52$6mm@mark.ucdavis.edu>
NNTP-Posting-Host: toadflax.cs.ucdavis.edu
X-Newsreader: TIN [version 1.2 PL1]

For those who check their marks via the "cs122at" mail interface:

The weights of each problem set used to be 3.33% each.  Today I changed
them to reflect the number of problems in each set; this means problem sets
with 3 problems (PS4, PS7, PS8) are worth 2.9% each, those with 4 problems
(PS1, PS3, PS5) are worth 3.87% each, and those with 5 problems (PS2, PS6)
are worth 4.84% each.

The total should add to up 30%.

john//

>From news.ucdavis.edu!toadflax!blackj Thu Dec 12 10:37:35 1996
Path: news.ucdavis.edu!toadflax!blackj
From: blackj@toadflax.cs.ucdavis.edu (John R. Black)
Newsgroups: ucd.class.ecs122a
Subject: Hints for #2a
Date: 4 Dec 1996 07:26:22 GMT
Organization: University of California, Davis
Lines: 37
Message-ID: <58392u$1h3@mark.ucdavis.edu>
NNTP-Posting-Host: toadflax.cs.ucdavis.edu
X-Newsreader: TIN [version 1.2 PL1]

I said the following in office hrs today, so I wanted to post here for those
who are stuck on #2a and didn't come to office hours.

There *is* a configuration for n=3 which does not terminate.  Searching
haphazardly will probably not discover it; you must search systematically.
Here is how I found it:

Start with the marriage Aa Bb Cc and the preference lists:
	A
	B
	C
	a
	b
	c

Then decide which pairs are unstable; they're all equivalent to start with,
so just choose A and b (i.e. A wants b more than a, and b wants A more than B).
So the new preference lists look like this:
	A	_b_a_
	B
	C
	a
	b	_A_B_
	c

And we marry Ab leaving Ab Ba Cc.  I left underscores above to indicate
the positions which c and C could take later on; we haven't yet determined
where they go and we want to be as flexible as possible because we need to
keep the marriages unstable (if the marriages become stable, the algorithm
terminates!).

Now enumerate the possibilities from here.  It takes a while, and you have
to think carefully, but you will eventually find a set which cycles.

Good luck...

John

>From news.ucdavis.edu!usenet Thu Dec 12 10:37:36 1996
Path: news.ucdavis.edu!usenet
From: Phil Rogaway <rogaway@cs.ucdavis.edu>
Newsgroups: ucd.class.ecs122a
Subject: review session
Date: Thu, 05 Dec 1996 13:31:12 -0800
Organization: University of California, Davis
Lines: 5
Message-ID: <32A73F20.167E@cs.ucdavis.edu>
NNTP-Posting-Host: rogaway.cs.ucdavis.edu
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.0 (X11; U; IRIX 5.3 IP22)

The 122a review session will be held
   Wednesday, Dec 11, from 7-9pm, in 1130 Bainer.
See ya there!

Phil Rogaway

>From news.ucdavis.edu!usenet Thu Dec 12 10:37:36 1996
Path: news.ucdavis.edu!usenet
From: Phil Rogaway <rogaway@cs.ucdavis.edu>
Newsgroups: ucd.class.ecs122a
Subject: non-standard office hours
Date: Sun, 08 Dec 1996 14:31:54 -0800
Organization: University of California, Davis
Lines: 9
Message-ID: <32AB41DA.41C6@cs.ucdavis.edu>
NNTP-Posting-Host: rogaway.cs.ucdavis.edu
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.0 (X11; U; IRIX 5.3 IP22)

I suspect that non-standard office hours might better suit
your needs this week, and so the following replaces my usual 
hours:

   W 7-9 pm - review session
   R 6-7:30 pm - office hours
   F 12:30-1:30 pm - office hours

-Phil Rogaway

Subject: Favorite Algorithms
Date: 17 Dec 1996 01:19:28 GMT
From: blackj@toadflax.cs.ucdavis.edu (John R. Black)
Organization: University of California, Davis
Newsgroups: ucd.class.ecs122a


Here are the stats for which algorithms were the favorites during the final
exam.  Dijkstra's, KMP, and Kruskals all tied with 3 votes each (also
I threw various flavors of "greedy" together to get another category with
3 votes).

The student who specified "stooge sort" lost points for not indicating which
stooge he intended.

My favorite?  Well, personally I want thank Dr. Rogaway for his lecture on
topological sorting: since then I've rarely put my socks on after my shoes.

Thanks to everyone for making our job enjoyable and rewarding; best of luck
in your careers...

John Black

-----------------------------------------

All Pairs Shortest Paths        1
Depth First Search              1
Dijkstra's                      3
Forward Radix                   1
Greedy Algs                     3
Heapsort                        1
Huffman                         2
KMP                             3
Kruskal's                       3
Mergesort                       1
NP-Completeness Reductions      1
Program Checking Algs           1
Quicksort                       1
Radiosity (?)                   1
String Matching Automaton       1
Stooge Sort                     1
Stable Marriage Alg             2
Z-buffer (graphics alg)         1


