COS 226 Programming Assignment 2 - Checklist


Checklist 2: Sorting and merging networks

The following is a checklist which provides a summary of the assignment. This is meant only as a supplement; please read the original assignment description.

  • Frequently Asked Questions
  • Overview
  • Requirements
  • Possible Progress Steps

  • Frequently Asked Questions:
    (This is the only part of this checklist which will change during the week.)


    Overview: This week, we have provided three files which you will need, batcher.c, batcher.h, and Sort.c.

    You are asked to accomplish three different tasks:
    TaskA: use random floats and count comparisons used
    TaskB: print out sequence of exchanges and parallel stages
    TaskC: implement a block sort

    Each task is to be acomplished purely by modifying Sort.c. You are not allowed to modify either batcher.c or batcher.h. Please do not submit batcher.c or batcher.h -- we will use the originals.

    For each of the three tasks, you are to submit a separate version of Sort.c, modified accordingly. Of course, to submit these, you must give each version a different name (may we suggest SortA.c, SortB.c and SortC.c for the three different tasks?). For this week's readme file, please provide a single file, which includes a separate section for each of the three tasks, containing any required information.

    Below we summarize exactly what is required for each task. This week, the checklist will not contain a "progress steps" list, as the steps for progress are clearly written in the original assignment.

    Want to see one example of a blocksort in action? click here.


    Requirements:
  • Task A:
  • Your program should generate and use random floats (or doubles)
  • Your program should count the overall number of compexch calls
  • readme: Please include a table reporting the number of compexch calls used when N=16, 32, 64, 128, 256, 512, 1024, 2048, or 4096.
  • Task B:
  • program should output thef compexch calls made, grouped based on parallel stages. (pairs should reference the original data indicies)
  • readme: You should give the stages of compexch calls made when N=16 and N=32
  • readme: You should give a formula for the number of parallel stages needed to sort N elements, when N is 2 to the nth power.
  • Task C:
  • Implement block sort, as described.
  • readme Run your program for N=1024, 2048, 4096, 8192 and 16384, for each choice of blocksizes M=8, 16, 32. Give a 2-dimensional table, reporting for each pair (N,M) the total number of key-key comparisons made, including both the initial insertion sorts together with your modified compexch routine.

  • Possible Progress Steps: These are purely suggestions for how you might make progress. You do not have to follow these steps.
  • TaskA: self-explanatory
  • TaskB: before you worry about parallel stages, you can first try to output the sequence of compexch calls made, to compare with the lists given for N=2,4,8 in the assignment. However this is NOT the output which we ask for in the readme, only a step for your progress.
  • TaskC: you better be familiar with Chapter 11 of the text!

  • cos226 Home Page
    rs@cs.princeton.edu
    Last modified: February 14, 2001