Assignment 1

Due Date: Aug 2, 2011

Q1: Write a mathematical specification for the input state and the output state for SWAPPING the contents of two program variables x and y.

Q2: Characterize lexicographic ordering of words in a dictionary

Q2a. Write the input and output specification of the following problem: Given a dictionary D in lexicographic order, and a candidate word w, return true and the index in D of w's entry if it is there, and false otherwise.

Q3: Write the input and output specification of SORTING a list of words in lexicographic ordering (given a list of words in some arbitrary order, return a list of the same words now organized in lexicographic/dictionary order).

Q4: Write the input and output specifications of the problem of finding the root of f(x) in an interval [a,b], where f(a) < 0 and f(b) > 0 and assuming there is a single root in this interval.

Q5: Write down three properties (in English, but an unambiguous statement) that you think the lifts in the Bharti building should satisfy.