Assessment Tool

Lecture 16: Sorting

Content Tested:  Selection Sort (and possibly other sorting strategies)

Lecture Content:

Goals:

Assessment Technique:  Drama

Purpose:

To allow instructors to find out if students understand the selection sort algorithm and apply it to sorting people by height.
 

Activity:

We saw the selection sort algorithm in today's lecture.  As a class we will sort ourselves based on height according to the selection sort algorithm.  As a refresher, here's the code for selection sort with numbers in array b[].

void sel_sort (int b[], int n){
    int k, m;
    for (k=0; k < n-1; k = k+1){
        m = min_loc(b, k, n);
        swap(&b[k], &b[m]);
    }
}

int min_loc (int b[], int k, int n){
    int j, pos;

    pos = k;
    for(j = k+1; j < n; j = j+1){
        if(b[j] < b[pos])
            pos = j;
    }
    return pos;
}

Line up randomly in one row as a class.  If there are more than 20 people in the class then the instructor will ask for volunteers.  Once you have found a spot in the line, we'll begin sorting ourselves by height according to the selection sort algorithm.
 

Note to Instructors

You probably do not need to give students a copy of this exercise.  Instead, put the selection sort routine on the board or on the overhead projector so they have a reference.  Encourage them to "sort themselves" with minimal help from you.  Ensure that the students do follow the algorithm.

Possible Uses of Activity: