LMU ☀️ CMSI 2130
ALGORITHMS
HOMEWORK #3

Instructions

Turn in all solutions (including those requiring code) neatly typeset on 8.5" × 11" paper, with a staple in the upper left corner.

Store your files in a private GitHub repository named <yourgithubname>/cmsi282. At the top level of this repository create a folder called homework3 in which your files will be placed. During grading, I may clone your repository and run my own test suite on your code, so don’t forget to give me access to your repo. My github name is rtoal. I will be looking for your code in the branch master, of course.

I encourage you to work in pairs. Please submit only one solution set for your team.

This is due at the beginning of class on Tuesday, March 29, 2016.

Readings, Videos, and Practice

Just read, watch, and do. You do not have to take notes or write reports on them; however, don’t cheat yourself by skipping them. These independent learning units must be done individually, but please feel free to discuss these items with your partner, your friends, or even with the rest of the class on the Discussion Boards.

The Problems

  1. Write a backtracking solver for the Kirkman Schoolgirl Problem. Be aware that naive solutions take days, months, or even years to complete, so you will have to be smart about bactracking. Strike a balance between beautiful code and very fast code. You must be both fast and clean. Implement your solution in a single file, named kirkman.py, kirkman.js, kirkman.coffee, kirkman.swift, or KirkmanSolver.java, according to your implementation language.
  2. The course notes on Backtracking talk of the possibility of writing a backtracking engine, parameterized by a solution array and a function for computing whether a given (partial) solution is acceptable. Implement this engine, as well as solutions to the no-equal-adjacent-substrings problem and the N-queens problem that use the engine. If you are using Java, you must name your files BacktrackingEngine.java, QueensSolver.java, and NeasSolver.java. There's one more Java requirement: the backtracking engine must be a generic class. Filenames for other languages should follow the conventions shown here for Python: backtracker.py, queens.py, and neas.py. Use generics for statically typed languages.