Problem Set 3: Ordered Sets

Due March 2, 11:59:59 pm.
This assignment is to be done in groups of two students. 


READ THESE INSTRUCTIONS: A major purpose of this problem set is to demonstrate the importance of designing your data structures wisely. If you read through the entire problem set and think about all of the functionality you will need for your data structure, you should be able to write one versatile data structure that you will be able to use through all of the problems to simplify your life immensely and achieve the efficiency you need in each of your solutions. The data structure should be an ordered set implementation, though you may choose to add functionality beyond that of an ordinary ordered set. Design your data structure with care. When you hand in your problem set, you will hand in one file with your data structure and big-O analyses of any operations that you will rely on the efficiency of in a later part of the problem set. That is: if your efficiency analysis of your query engine lookup for part 2 relies on the efficiency of your data structure's "find" functionality, you must include an analysis of that "find" function's efficiency in your data structure file. You will also hand in six files with your work for the problem set -- one each for parts one through four, two for part five. Use the stub files available on CMS through the "source" link.

Regarding data structure design: you may not use, within your data structure, any data structures within the SML library except for SML basic types (int, char, string, real, bool, tuple, record) and the Vector structure. Put effort into designing your datatype with as much functionality as you need to make the other 4 parts of the problem set as easy on yourself as possible. Furthermore, the efficiency of your solutions counts in this problem set, which means the efficiency of the operations your data structure supports counts. You will not receive full credit for solutions with sub-optimal running times. Note that the insertion time into an unbalanced tree is O(n), not O(log n).

This problem set will be completed in groups. Each of your six files should have both of your names, netIDs, and sections in a comment at the top. As always, all programs that you submit must compile. Programs that do not compile will receive an automatic zero. If you are having trouble getting your assignment to compile, please visit consulting hours. If you run out of time, it is better to comment out the parts that do not compile and hand in a file that compiles, rather than handing in a more complete file that does not compile. Also, please continue to pay attention to style. Refer to the CS 312 style guide and lecture notes. Take the extra time to think out the problems and find the most elegant solutions before coding them up. As before, it is important that you do not change the names of the functions or structures.

When submitting your implementations for the following problems, you should be sure to include all of the code that you used to test your implementation. The completeness of these test cases will be a part of your grade. Even if your solution to a problem is well-written and correct, lack of exhaustive test cases could cost you points.