CPS 100E, Fall 1996 Inlab 8
Name:
Lab Section:
You should answer the following questions and either
turn in the sheet during lab, or answer the questions
when you submit your README file.
These questions are worth 2 out
of the 10 points for each lab. You don't need to get all
the answers right to get the 2 points, but you must try.
It's ok to ask a UTA or TA for help, but first you must
try to find the answers on your own.
-
What is the purpose of the constants MIN_STR and
MAX_STR in sortall.cc
- The function InsertSort is defined as the following
template
void InsertSort(Vector & a, int size)
// precondition: size = # of elements of a
// postcondition: a is sorted
//
// uses insertion sort
{
Insert(a,0,size-1);
}
Why don't we just call Insert rather than go through
InsertSort
- (This question was also asked in the lab writeup.)
What happened to the speed of Quick Sort when the elements in the
array were limited to be less than 100? Why did the speed
decrease so much? How and why
did the new partition function Pivot3
affect the speed of the algorithm?
- In this lab, we generated random strings to be sorted. Is this a
fair test of the sorting algorithms? Why or why not?
- How is the "pivot" (element to partition) the array for Quick sort
chosen?