Assignment 3

Assignment 3 - CS 136 Fall 2009 Kate Larson Assignment 3...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 136 Fall 2009 Kate Larson Assignment 3 Due Tuesday, October 13, 2009, 10pm Language level : Module (full PLT Scheme). You may use elementary mutation ( set! and set-box! ) for this assignment. Question 3 involves simple modi±cation of C programs. To submit : table.ss , table-driver.ss , knapsack.ss , knapsack-driver.ss , knapsack-memo.ss , knapsack-memo-driver.ss , a3-script.txt , print.c 1. We have de±ned an immutable table ADT in Module 1. A table is a set of (key, value) pairs, which can be implemented by an association list. Each element in an association list is a (key, value) pair. For example, ( list ( list 1 100 ) ( list 3 58 )) is an association list. It is also possible to de±ne a mutable table. A mutable table is also a set of (key, value) pairs. The following operations are de±ned for mutable table ADT. make-table : no parameters; precondition and postcondition “true”; value produced is the empty table φ . add : three parameters, a table T , a key k , and a value v ; precondition “true”; no value produced; postcondition is if there exists a value v such that ( k, v ) T , then T T \ { ( k, v ) } ∪ { ( k, v ) } , otherwise T T ∪ { ( k, v ) } . remove
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

Assignment 3 - CS 136 Fall 2009 Kate Larson Assignment 3...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online