Compsci 6, Fall 2011, Classwork 23

PRINT Names and NetID of students in group (min 2, max 3)
Name: __________________________   NetID: _____________

Name: __________________________   NetID: _____________

Name: __________________________   NetID: _____________

Problem 1

Consider the passes shown for a sort. Which sort is it? 4 10 5 3 8 2 4 2 5 3 8 10 4 2 5 3 8 10 4 2 3 5 8 10 3 2 4 5 8 10 2 3 4 5 8 10

Problem 2

Write mergeSort2. Assume merge exists from last time. merge(L1, L2) assumes L1 and L2 are both sorted and returns a sorted list of the merge of these two lists. def mergesort2(list)

Problem 3

Compare the sorts SelectionSort, InsertionSort and BubbleSort on three different types of data. Which one is faster? How much faster?

  1. random data
  2. Data in reverse sorted order
  3. Data in almost sorted order