University of Virginia Computer Science
CS216: Program and Data Representation, Spring 2006

17 May 2006

Program and Data Representation

Spring 2006

1. Mondays, 7-8:45pm, THN D223
2. Tuesdays, 3:30-5:15pm, THN D221
3. Tuesdays, 7:30-9:15pm, THN D223

Small Hall On-Call Hours
Assistants will be available in Small Hall at these times:

Sundays 3:30-5 (KJ), 5-6:30 (EG), 6:30-8 (EC), 8-9:30pm (SG)
Mondays, 5-6pm (SG)
Tuesdays 5:30-7pm (PS), 7:30-8:30pm (PL)
Wednesdays 7-8:30pm (DF)
Thursdays 4-5:30pm (KJ), 6:30-7:30pm (EG), 7:30-8:30pm (EC)
Fridays 11am-12:30 (DF), 3:30-5pm (PL)
Saturdays 3-4:30pm (PS)
Note: Additional times may be scheduled based on demand and AC availability.

Office Hours (Olsson 236A)
Wednesdays, 2-3pm
Thursdays, 1:30-2:30pm
Fridays, 10:30-11:30am

Classes | Schedule | Problem Sets | Exams | Guides

Upcoming Schedule

  • Monday, 8 May (5:00pm) : Final Exam (the Final Exam was handed out in class on May 1 (extra copies are available in the cs216 pigeon hole in the Olsson Hall entranceway) and is due before 5:00pm on Monday, 8 May)


  • 1 May: Class 26 [PPT, PDF]
  • 27 April: Exam 2 Comments
  • 26 April: Class 25: Randomized Algorithms [PPT, PDF]
  • 26 April: There will be no scheduled Small Hall hours or Section meetings for the rest of the semester.
  • 24 April: Class 24: Fast Dictionaries [PPT, PDF]; Problem Set 8
  • 20 April: There will be no section meetings next week (April 24 and April 25). There will be no staffed Small Hall hours between now and Wednesday, April 26.
  • 20 April: Exam 2 is now posted. If you want to print it yourself, please use the PDF file: exam2.pdf. Alternatively, you can pick up a printed copy from the CS216 box in the entrance to Olsson Hall.
  • 19 April: PS7 Comments
  • 19 April: Class 23: Fast Dictionaries [PPT, PDF]; PS6 Comments
  • 17 April: PS4 Comments (sorry for the delay posting these!)
  • 17 April: Class 22: Unconventional Calling [PPT, PDF]. Some papers related to today's class:
  • 16 April: Lucas Gravitt pointed out that my description of the x86 C calling convention was incorrect. The EBX register is callee-saved (it must not be bashed by the called routine), not caller-saved.
  • 15 April: If you are working on PS7 outside the ITC labs, you will need the MASM assembler. You can download it here: ml.exe
  • 12 April: Congratulations to the Byte Code Wizardry Award Winners:
    Winners: Jake Fowler and Sean Talts
    First Runner-Up: Michael Thomas and Billy Chantree
    Second Runner-Up: Will Ashford and Mike Dietz
    Black Hat Honorable (?) Mentions: Richard Hsu and Dan Chen, Michael Thomas and Billy Chantree, Mike Liu, Jongmin Kim
    The original source program:
  • 12 April: Class 21: Calling Conventions [PPT, PDF]
  • 10 April: Class 20: Hair-Dryer attacks and Introducing x86 [PPT, PDF]; Guide to x86 Assembly [PDF], Guide to Using Assembly in Visual Studio, Problem Set 7 [PDF]; PS5 Comments The paper about using light bulbs to attack the JavaVM is here: Using Memory Errors to Attack a Virtual Machine, by Sudhakar Govindavajhala and Andrew Appel (IEEE Symposium on Security and Privacy, May, 2003).
  • 6 April: Mac disassembler: Jasper is a functional alternative to D-Java for Mac OS X users, see (Thanks to Adrienne Felt for finding this.)
  • 6 April: Class 19: Java Security [PPT, PDF]. The data on Java vulnerabilities is from this paper: Nathanael Paul and David Evans, Comparing Java and .NET Security: Lessons Learned and Missed (to appear in Computers and Security). [461 Slashdot comments]
  • 5 April: Some of the work I talked about in Monday's class is described in these papers:
  • 5 April: The submission page for PS6 is now up. You only need to submit if you want to be eligible for the Byte Code Wizard awards.
  • 4 April: There's a bug in D-Java that is causing problems with the original file. The version of Mystery.class in the original zip file used some wide instructions, but D-Java does not disassemble them correctly, so when you try to use jasmin to assemble the result, it produces an error. The new Mystery.class file works around this problem. You can download it from (or you can redownload the file). The first thing you should try for questions 8-10 is to know that the D-Java/jasmin steps produce a correct class file:
       ] D-Java -o jasmin Mystery.class > Mystery.j
       ] java -jar jasmin.jar Mystery.j
       Generated: Mystery.class
       ] java -classpath . Tester
          ( should produce many lines of "................." followed by,
            Passed all tests in [xxx] milliseconds. )
    Don't try to modify the jasmin file until you confirm that it works without any modifications. Sorry for the trouble with this - I had discovered this problem earlier and produced the workaround class file, but included the wrong one in the file.
  • 2 April: The command to convert a Java class to jasmin was wrong on the original PS6 handout. The correct command is:
       ] D-Java -o jasmin Name.class > Name.j
  • 29 March: Class 18: Code Safety [PPT, PDF].
  • 27 March: Class 17: 0xCAFEBABE (Virtual Machines) [PPT, PDF].
  • 26 March: Note that it is not necessary that your implementation satisfy all the desired properties listed in Question 6. You should consider designs that would satisfy those properties, but focus on simplicity in what you decide to implement for questions 7-9. It is much better to get a simple implementation working first, and then try to improve it rather than falling into the trap of trying to implement something overly complicated to achieve ambitious performance and storage goals. Since a pointer uses 1 word of memory, coming up with a design that satisfies all 3 desired properties is quite challenging!
  • 26 March: I will not be able to keep my office hours this Wednesday. If you would like to meet with me, please send email to arrange a different time.
  • 26 March: The original PS5 handout example for Question 1 used "litte-endian" when it should have said "big-endian" (the most significant bits in the example are leftmost in the representation shown). Of course, it doesn't affect your answer to Question 1 if the register is big-endian or little-endian: the power analysis only reveals the number of bits that flip, which is identical for both representations; which bits are flipping doesn't matter.
  • 23 March: I will not be able to keep my office hours tomorrow (Thursday). If you would like to meet with me, please send email to schedule a time.
  • GAO: Patriot Missile Defense report. Note that the values in Appendix II match exactly what we calculated the error to be with 24-bit floating point numbers. (Also see, The Patriot Flawed?, 60 Minutes Story, June 27, 2004, focusing on other problems with the Patriot software.)
  • 22 March: Class 16: Numbers [PPT, PDF]; Problem Set 5 (only 1 week!)
  • 20 March: Class 15: Compression [PPT, PDF] (not used in class)
  • 13 March: Here is Huffman's original paper: A Method for the Construction of Minimum-Redundancy Codes
  • 13 March: Class 13: Huffman Codes (chalk only); Problem Set 4 [PDF]
  • 1 March: Class 12: Automating Memory Management [PPT, PDF]; Exam 1 Comments [PDF]
  • 27 February: There are no regularly scheduled Small Hall hours this week or during Spring break. Normal Small Hall hours will resume after Spring break (Monday, 13 March).
  • 27 February: Class 11: Managing Memory [PPT, PDF]
  • 22 Feburary: Exam 1 [PDF for printing]
  • 22 February: Class 10: Pointers [PPT, PDF]
  • 20 February: Problem Set 3 Comments
  • 20 February: Class 9: Low-Level Programming [PPT, PDF]. If you want to listen to the John Cage piece from today's class (which I certainly don't recommend), you can do so here: Fontana Mix
  • 15 February: Class 8: Slides [PPT, PDF]
  • 15 February: Some papers on NP-Completeness:
  • 14 February: I will be out of town Thursday and Friday and unable to hold my usual office hours. I am not able to hold my Wednesday office hours this week either. Please email me to arrange a different time.
  • 13 February: Section 4
  • 13 February: Class 7: Slides [PPT, PDF]; PS2 Comments [PDF]
  • 9 February: Problem Set 3 [PDF] (printed copies are available in the pigeon hole for CS216 in the front entrance of Olsson Hall)
  • 8 February: Class 6: Slides [PPT, PDF]
  • 6 February: PS2 correction: For question 9, the question lists the wrong number of expected trees. You should get 60 trees if you include all trees, or 11 trees if you only include the distinct trees (that are not equivalent if you swap the left and right children). There are tree counts between these that include some of the isomorphically equivalent trees which are reasonable answers to question 9 also. The expected trees are here.
  • 6 February: Section 3 [PDF]
  • 6 February: Class 5: Slides [PPT, PDF]; PS1 Comments; RSA Paper [PS] (not required for CS216)
  • 4 February: If you enjoyed Portman Wills' talk Thursday, you may want to watch the movie that he and Adam Glaser made for an assignment in CS588: Safe Computing @ UVa [Quicktime Movie]
  • 31 January: Fact and Fiction in Alignment [PDF], Nature, July 1992 (see bottom right corner).
  • 30 January: Class 4: Slides [PPT, PDF], Notes
  • 25 January: Class 3: Slides [PPT, PDF]
  • 23 January: Survey Results
  • 23 January: We have an addition assistant coach, Phu Le. He will have Small Hall Call hours Fridays 3:30-5 and Saturdays 4:30-6.
  • 23 January: My Thursday office hours have been moved (permanently) to 1:30-2:30pm due to a scheduling conflict
  • 22/23 January: Section Worksheet
  • 22 January: Remember the Sections meet in the Thorton Hall classrooms (see left), not in the Olsson Hall basement lab.
  • 22 January: Class 2: Slides [PPT, PDF], Notes, Course Pledge
  • 22 January: Additional Small Hall Call hours (Sundays, 8-9:30pm, Mondays, 5-6pm, and Thursdays, 4-5:30) and Office hours (Thursdays, 11am-noon 1:30-2:30pm) have been scheduled based on the survey responses. (See left for full list.)
  • 20 January: The bookstore does not expect to have the textbook back in stock until Tuesday, so the due date for PS1 has been postponed until Monday, Jan 30. (Those of you already on the etoolkit course list should have received a more detailed email explanation.)
  • 19 January: A guide to using the Python development environment in ITC labs is here: IDLE Guide (you should use this to get started on the programming part of PS1)
  • 19 January: Note that the actual due date for Problem Set 1 is Wednesday, Jan 25 (the Problem Set handout incorrectly lists the due date as Monday, Jan 23).
  • 18 January: Class 1: Slides [PPT, PDF], Syllabus, Schedule, Problem Set 1, Registration Survey, Python Guide
  • The first class will be Wednesday, 18 January at 11:00am in Olsson 120.
  • The required textbook for CS216 is:
    Harry R. Lewis and Larry Denenberg, Data Structures & Their Algorithms, Addison-Wesley, 1991. ISBN 0-673-39736-X.
    It should be available soon at the UVa Bookstore, or you can order it from:
  • Last Year's CS216 Course

Past Due Assignments

  • Sunday, Jan 22 by 5pm: Submit Registration Survey
  • Monday, Jan 23 (before class): Read Chapters 1-3 of the textbook
  • Sections Monday, Jan 23 and Tuesday, Jan 24: Course Pledge
  • Wednesday, Jan 25 Now due Monday, Jan 30 (beginning of class): Problem Set 1
  • Wednesday, Feb 1, 10:30am: Ron Rivest, Security of Voting Systems. Newcomb Hall, South Meeting Room. Go to the talk instead of CS216. Flyer
  • Thursday, Feb 2, 3:30pm: Portman Wills' talk, Saving the World with a Computer Science Degree. MEC 205 (coincident with CS290/CS390). Flyer
  • Wednesday, Feb 8 (beginning of class): Problem Set 2
  • Wednesday, Feb 15 (beginning of class) or Friday, Feb 17 (4:50pm): Problem Set 3 (if you don't turn PS3 in in class, turn it in to Brenda Perkins in the CS office before 4:50pm Friday)
  • Monday, Feb 27 (11:01am): Exam 1
  • 6 - 12 March: Spring Break (no Small Hall hours or scheduled office hours; email to arrange an appointment). Problem Set 4 will be handed out on Monday, 13 March.
  • Today (Monday, 15 March), 5pm: If you want to be assigned a partner for PS4, send me mail before 10am Tuesday (16 March) (extended from 5pm Monday)
  • Wednesday, 22 March (beginning of class): Problem Set 4: Huffman Coding [PDF]
  • Wednesday, 29 March (beginning of class): Problem Set 5: Representing Numbers [PDF] [Code Submission]
  • Monday, 10 April (beginning of class): Problem Set 6: Nibbling at Byte Codes [PDF]
  • Monday, 17 April (beginning of class): Problem Set 7: Eighty-Sixing Compilers [PDF] (will be accepted without penalty until class on Wednesday, 19 April)
  • Monday, 24 April (beginning of class): Exam 2
  • Monday, 1 May (see handout for details): Problem Set 8 [PDF]

  • CS216: Program and Data Representation
    University of Virginia
    David Evans
    Using these Materials