Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

http://cs.bilgi.edu.

tr

Comp 231 / Cmpe 211 Worksheet (Week 3)


Classwork
You will be assessed on the quality of your code, which should include data denitions, contracts, statements of purpose and on the quality of your test data. You should submit a written record of what you did and the results you got to the assistant at the end of the class. Record your interactions in a le. Your work will be graded on the spot. 1. Demonstrate your project 01 code, as uploaded to the online system, to your assistant. You will be given a grade. 2. If your project 01 code does not work, get it working and show the result to your assistant to get approval to proceed. 3. Modify your code to allow your sort to sort arrays of objects that implement the comparable interface. 4. Modify your test setup to generate arrays of objects of class Student, implementing the Student class to have rst name, last name, student number components and to implement the comparable interface. Your randomizer should generate names from libraries of rst and last names (you may data mine your own class lists for these). 5. Show that by simply changing the implementation of the compare method in the Student class, you can get the same insert sort code to sort by student number, or by last name and then rst name, or by rst name and then last name. 6. Specify, design and set up tests for the partition method of quicksort to sort arrays of objects of class Student. 7. Get your partition method working.

Document last compiled on October 31, 2013

http://cs.bilgi.edu.tr

Reading - to be completed by 4 November


Revise Cormen Chapters 1, 2 and 3 and read, for the rst time, Chapter 7. (3rd Edition) Answer questions 3.1-3, 3.2-8, and solve problems 3-4 a,b,d,g, and problems 7.1-2, 7.2-5 and 7.4-5 Please do not submit the answers to these questions as solutions are known to be available online. However, you should solve the questions yourself and only look at any online solutions to check your own work, if at all. Solving these questions yourself will prepare you for future quiz questions and for the mid term exam. Trying to memorize online solutions will not prepare you for future quiz questions. If you have time, trying other questions from these chapters of the book is very good practice.

Project 02
Deadline: 0900 Wednesday, November 6

Irrelevant code will be penalised1 in project submissions. Before anything else you are required to complete and correct your class work so all the programs work correctly. If you fail to do this, your project will be treated as unacceptable. (a) Complete the class work. (b) Now write a complete quicksort method. (c) Graph the times for quicksorts of arrays various sizes against the size of the array, testing arrays in random order, in already sorted order, and in reverse sorted order. You can use a spreadsheet to process your data conveniently. If T is the time taken for each sort, and n is the number of elements in the array being sorted, plot n on the x-axis and T on the y-axis. Then try plotting n on n T the x-axis and lgn on the y axis Comment on any dierence in the shape of the curves that you observe. The acceptable project policy will apply in this course. To obtain any coursework mark at all, all projects from now on must have been submitted to an acceptable standard. No subsequent project will be accepted until all its predecessors
Document last compiled on October 31, 2013

http://cs.bilgi.edu.tr

have been accepted. Unacceptable projects may be resubmitted, but will only get 50% marks in the rst week after the deadline, 33% marks in the second week after the deadline and so on. You are free to take your projects to the assistants before the deadline to check their acceptability. You will need to start trying to nd the assistants early. I could not nd an assistant to check my project is not an excuse. The class hours may be a good time to nd them. To be acceptable a project must run and must perform the specied task. It must, at minimum, include test data that exercises all the code with complete coverage. It must include sample inputs and output and comments on the working of the code. The project description is very open ended. There are lots of dierent ways it can be completed. So apart from the basic functions we have worked on in the lectures, we will expect all project submissions to be dierent and copies will result in failure of the course.

Deadlines
Deadline: 0900 2013-11-06 (Wednesday morning!). Do not forget report and screenshots. Submission of 70% of projects is required to pass the course. To be counted as a submission, your program must compile and run and be your own work. Assessors decision is nal. c Chris Stephenson 2013

Document last compiled on October 31, 2013

You might also like