For this lab, you are welcome to get technical help from another student on how to use or install any of the tools involved. You may also get syntax help on C. You may not, however, get help on the algorithmic portion of the exercise outside of office hours or piazza questions to TAs or instructors.
Click here for a nice example with explanation for how to use valgrind and interpret its results.
You can use valgrind if you log into the main cs department computers:
ssh cnetid@linux.cs.uchicago.eduYou can check out your repository there, compile it, and test it. You may use vim to edit your code there.
$ cd CNET-cs152-spr-16 $ mkdir hw6 $ svn add hw6 $ cd hw6
$ cd cs152-spr-16-duet-X $ svn update $ mkdir hw6 $ svn add hw6 $ cd hw6
You also need to copy in some of your solutions from last week's assignment. You need to copy over your queue code and llist code.
$ cp ../hw5/queue* . $ cp ../hw5/llist* .
I am providing several files. For each file, create the file in vi and paste in the code I provided. The files are:
Don't forget to svn add* to make sure they are all in the repository!
Good luck and have fun learning together!During this warmup, you are going to implement several functions that exercise trees. If you are using Duet Programming, do not forget to trade off after each function. The functions are ordered to provide specific practice to each student.
In your weekly assignment this week, you are working towards a single problem. During the warmup, you'll complete several binary search tree functions that you'll use in the homework problem.
Problem 1: word struct and functions
You will first create a struct that will be used to test the binary search tree. As you know, to use a binary search tree, the struct being stored needs to provide a compare function for insertion. The word struct contains two fields: a string and a count. You need to implement two functions: compare_counts, and compare_words. The details of the functions are in word.h.
Problem 2: binary search tree
You are writing several binary search tree functions (bst):
Think very carefully about the order in which you will implement these. Specifically, what is the minimum number of functions you need to implement in order to fill and print out a bst (putting in wordcount structs)? Choose the simplest functions that will give you this functionality.
You are not expected to complete this in lab. You are welcome to, but not required to, work with your duet partner after lab is over. If you wish, you may copy over your work so far and work independently after lab.
In this assignment first figure out the order in which you should solve the functions in order to implement the simplest first and get testable functionality.
Then design a test plan for that simplest set of functions. Split the set of functions necessary for minimal testing, and each of you implements a subset of those functions. Make sure you are splitting functions so that each student completes ones of roughly equal difficulty. Giving easy functions to one and complex to another feeds the gap in understanding rather than brings your understanding closer together!
When you have completed your part of the code, update and commit.
Discussion part 1: Look at the input ranges from the black box tests. Is there separate code to handle each case? If not, are the different ranges equivalent? Also, verify that the boundaries in the input ranges match the boundaries present in the code.
Discussion part 2: Looking at student A's code, jointly develop a set of white box tests that exercise all paths in the code. If you developed more tests than the black box tests, discuss whether that code is necessary, or whether the initial tests were insufficient.
$ svn add hw6
$ svn add hw6/*.h
$ svn add hw6/*.c
mkdir CNET-cs152-spr-16/hw6 cp cs152-spr-16-duet-0x/hw6/* CNET-cs152-spr-16/hw6/* cd CNET-cs152-spr-16 svn add hw6
$ svn add hw6.h hw6.c test_hw6.c Makefile
$ svn commit -m "hw6 warmup complete"