Homework 1X Part 2

This is the second part of a three-part assignment. The ultimate purpose of this assignment is to write a children’s word substitution game. An evolving overview of the entire assignment can be found in the Overview of Homework 1X.

Due date

This assignment must be submitted as two files named WordMap.h and WordMap.c for Homework 1X Part 2 of the ECE 209.602 / CSCI 373.002 section on UNCA moodle by 11:00 PM on Thursday, 2 December.

Getting starting

Start by downloading the following three files.

You should store these files in a NetBeans project. (If you want to use gcc from the command line, a Makefile is available.)

You should be able to compile and run your program with these three files. However, to do something useful, you’ll need to modify WordMap.h and WordMap.c.

The goal for Part 2

In Part 2 you are to create a WordMap ADT. The WordMap will map a character string into a value. In the ultimate solution those values will be WordLoop’s; but to increase the usefulness of the WordMap and to allow you to work on Parts 1 and 2 simultaneously, in this case the values will be generic pointers or void *’s.

The map ADT is a widely used. It even has its own Wikipedia page. A Google for "map adt" will also provide you will about 5,000 references, though many are useless or are related to geography. The commments in the files you are using to start this part of the assignment can be considered the contract your code must satisfy for this assignment.

A ZIP file

If you are willing to take a chance, you can download a ZIP file that contains a image of a NetBeans project for starting the project. These haven’t been tested, but if they work (or don’t work) for you send me email.

Approaches to a solution

Your implementation of WordMap must work on maps of any reasonable sizes. There are only two common implementations of the map ADT: the binary search tree and hash tables. The testbook describes the binary search tree; however, most people use hash tables.

You can find many solutions using both of these implementation methods on the net and in textbooks. You are allowed (and even encouraged) to adopt these published implementation for use in your solution; however you must credit your sources and you must implement the map using the function prototypes decribed in WordMap.h.

I used hash tables in my implementation. Here is a table with the number of lines I added to the start files in my solution.

RoutineLines of C
WordMap.h 6
helper routine to allocate a single hash node
used in InsertWM
13
helper routine to search for node by key within hash list
used in InsertWM and LookupWM
11
CreateWM 16
InsertWM 18
LookupWM 7
DestroyWM 11

Keeping on schedule

Parts 1, 2, and 3 of Homework 1X are due on consecutive days. If you wait until after Thanksgiving to start this assignment, you will not complete it on time.

Grading

This homework assignment will be allocated 75 points, distributed as follows.

pointscritia
10 File submitted with proper name
5 Compiles with no warning using -pedantic or -std=c99
10 Program is readable and maintainable
10 Appropriate structures for dynamic data
10 CreateWM
10 InsertWM
10 LookupWM
10 DestroyWM