CISC2100: Discrete Structur LAB Class 1

Please run the following command to obtain solution to lab3 codes.

cp -r ~zhang/public_html/cs2100/LabClass/LAB1 . 

1. Problem Solving using math. induction and recursion

The book has a proof that shows the existence and uniqueness of binary representation of any integer that is not negative.

After fully understand the proof, work on binary.cpp file.

2. Recursively defined set

Palindrome is any string that is the same when read forward or backword, e.g., level, minim, radar, ....

  1. How would you define the set of palindrome recursively?
  2. How would you use the above definition to come up with a recursive function that checks whether a given string is palindrome?

With your basic idea, work on the palindrome.cpp.

3. Hash function and spell checker

We will learn about hash functions and their applications in class. Here you are asked to experiment with several different hash functions for hashing string (i.e., words) to integers. The code hash.cpp can potentially be extended to a spell checker.