Java PathFinder is a model checking tool for source code, developed by the formal methods group at NASA. You will use JPF to find a fault in two simple Java programs, Quicksort and MergeSort.
Make sure you have JPF running as described in the tools setup document.
In this assignment, you are given a piece of Java code. Download the Quicksort.java into your work directory. After you compiled the code, execute it using
java -ea Quicksort
to check that the code actually implements the quicksort algorithm correctly. You can modify the code to change the different array values if you wish to test the code.
Now, how sure are we that this quicksort algorithm performs under all circumstances? Now comment out Part I and uncomment Part II and recompile. Now run the following command.
jpf Quicksort
You will get a (long) error message. This assignment asks you to do the following:
Now download the MergeSortArray.java into your work directory. Follow the instructions above and do the same thing for this code.
Important: Do NOT rewrite the quicksort or mergesort algorithm. The purpose of this assignment is not to test your ability to code a sorting algorithm. It is show how using a tool like JPF can help to catch potential problems in your code. You solution should follow your analysis of what the problem is, how to fix it, and why the fix makes sense. A java implementation that clears JPF but lacks a good explanation will not receive full credit.
Turn in your version of Quicksort.java, MergeSortArray.java and writeup. Please indicate clearly in your writeup the answers for Quicksort and MergeSortArray. Write your name on everything you turn in.
100 points total. 70% for the writeup, 30% for the correct java implementation.
Email Quicksort.java, MergeSortArray.java and the writeup to meghan@cs.wm.edu.
Back to CSci 420/520 Homepage.
Last changed May 21 2008 15:31:40.
David Coppit,
coppit@cs.wm.edu
There have been 1323629 hits since Thu Jun 9 14:49:55 2005