CMPS-2020 - Programming II - Data structures and algorithms
This is part of your midterm exam.
This is an exam and so it it individual work by each student.
-------------------------------------------------------------

Your work will be done on Odin in your 2020/c/ folder.



Start with the phash program at:
    /home/fac/gordon/public_html/2020/a/phash.cpp

Copy the program to 2020/c/phash2.cpp

We will make some slight modifications in class together.

Create a text file named: 2020/c/phash2.txt

The questions below refer to the phash2.cpp program.
Answer the following questions in your text file.
-------------------------------------------------


1. What is the name of the hash table?


2. Where is the hash table accessed? Show one line of code.


3. How do you access a hash table?
    A. Start at the beginning and search.
    B. Turn data into an index, and go to the index.
    C. Divide the array in half, and go there.
    D. Go to the next pointer.


4. What kind of data is being used to generate an index into the hash table?


5. What operation is used to turn data into an index? Name the operation.


6. Show the line of code where data is turned into an index.


7. What would a function look like that turns the data into an index?
   Write the function. Name it hash_function.


8. Write a line of code that calls the hash function.


9. Each cell of our hash table stores an integer.
   How is the integer data used? What does it indicate?
   

10. Update your phash2.cpp program.
    Add a hash function.
    Call the hash function.
    Save your program.


The following files will be collected today Monday at 8:00pm.

    2020/c/phash2.txt
    2020/c/phash2.cpp