You are expected to complete this assignment individually. If you need help, you are invited to come to office hours and/or ask questions on piazza. Clarification questions about the assignments may be asked publicly. Once you have specific bugs related to your code, make the posts private.
This homework has a similar set of problems to what you did in the warmup. These will be used in next week's two-week project.
Problem 1: word struct and functions
You will implement the second comparison function for words: compare_counts
Problem 2: binary search tree
You are writing several binary search tree functions (bst) to add to what you implemented in the warm-up:
Problem 3: word count
You will write a function with the following interface:
bst* get_counts(char *filename);
This function takes in a filename. It reads in the file and splits the file into words. Words are broken by whitespace and punctuation of any kind. For simplicity, can't will be considered two words: "can" and "t". I suggest using fgets to read in the lines and strtok to divide the line into words.
Here is an example of a line of text and the words resulting from it:
hello, how are you? Welcome to CS152 today. We will study trees - bst's.
This function constructs a binary search tree consisting of the words in the file. It then increments the count each time it sees the word again.
Note that this function has a lot going on within it - and it will be hard to get partial credit if it doesn't work. Partial credit is from implementing the other functions in the warm-up and hw. However, to get credit for this problem, you need to finish it.
$ svn add *.c *.h Makefile testwords1.txt testwords2.txt
$ svn commit -m "hw6 complete"