Homework #3

Due: Tues, Oct 17, 3:59pm

How to Submit

  • Submit a single file named HW3.<your-username>.hs through TEACH.

  • Your submission must compile without errors in GHCi. Put all non-working parts of your solution in comments.

  • Please preserve the existing doctest comments in the template (the lines starting with >>> and the results underneath).

  • Read the Homework Policy! This describes what to do if you cannot solve a problem.


Template: HW3.template.hs

This assignment asks you to write three functions on a binary tree data type. Note that the data type is slightly different from the one used in HW1.

Download the above template, rename it, and define the undefined functions. The template contains English descriptions of the undefined functions, along with doctest comments that illustrate the intended behavior. Of course, feel free to add more examples to improve your test coverage.

The first two undefined functions include type definitions to help get you started. For the third undefined function, make sure to add the type definition before writing the function. You can figure out the type by looking at the doctest examples.

Back to course home page