All of the work in this project is my own!  I have not left copies of my code in public folders on university computers. I have not given any of this project to others. I will not give any portion of this project to others taking this class. I realize that the penalty for turning in work that is not my own can range from an "F" in the class to dismissal from Trinity University. 

                                    Print Name  ______________________________________    Time Required = ______.____ Hrs.

                                    Signature   ______________________________________    (pledged)
 

                                    Print Name  ______________________________________    Time Required = ______.____ Hrs.

                                    Signature   ______________________________________    (pledged)
 

                                    Print Name  ______________________________________    Time Required = ______.____ Hrs.

                                    Signature   ______________________________________    (pledged)

We did the

________ Selection Sort       

________ Insertion Sort       

________ Shell Sort       

________ Quick Sort       

Look up your sort in your text. I/We found the sort on page ________________ of our text book.
 

____________  Each team member has a copy of the solution to this lab in their "To Be Graded Folder" on Ananke!

____________  Each team member has copies of this project on at least two computers/drives.
 

Extra Credit

_____________ We have added complete error checking to the Fill  (if so, add enough code at the bottom of Main to show the errors that you have checked.

_____________ We have replaced the RandNo function with a better model that could provide a list of all the random number in the range 1-1,000,000. (If so, print and attach Utilities.cpp)
 


Simple Sorting Lab
Individual/Team Lab (1-3 Persons)
20 Points

1] Visual Studio Net 2005 should now be installed on your computer; you may use one of the classroom systems. Begin with a copy of the basic project folder. Start With a blank Project. Change the name of the project folder to FirstSort

2] Take a few minutes and look at all of  the  functions provided for you in the Utilities.hpp and Utilities.ccp files.

3] Your team is to code either the Selection Sort or the Insertion Sort or the Shell Sort or the Quick Sort. We will select in lecture.  You need not do all. If you are doing it individually, you choose.   

4] Hint : Note that the fill routine may not use Info[0]; thus your sort routine should not use Info[0].

5] Many sort solutions, that you find on the Internet or a text, begin with element 0; others begin with element 1. I am hoping that you find one that starts with element 0 so that you will have to make a slight alteration in the logic.                   

6] You are welcome to copy/paste any of the following that you like.

////////////////////////////////////////////////////////////////////////////////// 
////////////////////////////////////////////////////////////////////////////////// 
//                                                                              // 
//                           Elementary Sort??.cpp                              // 
//                                                                              // 
//  Purpose :                                                                   // 
//     Hint : Many sort solutions, that you find on the Internet or a text,     //
//            begin with element 0; others begin with element 1. I am hoping    // 
//            that you find one that starts with element 0 so that you will     // 
//            have to make a slight alteration in the logic.                    // 
//                                                                              // 
//  Written By : ???????????????????     Environment : Windows Vista            //
//  Date       : ??/??/????              Compiler    : Visual Studio Net 2008   // 
////////////////////////////////////////////////////////////////////////////////// 
//////////////////////////////////////////////////////////////////////////////////
# include "Utilities.hpp"

//----------------------------------- Structs ----------------------------------//
typedef struct
{
	long int 
		Info[1001],
		ActNo,
		Max;
}LongIntArray;


//--------------------------------- Prototypes ---------------------------------//
//You Do 

int main (int argc, char * argv[])
{
    puts ("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
    puts ("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
    puts ("++                     Elementary Sort Lab                   ++");
    puts ("++                                                           ++");
    puts ("++                         Writen By                         ++");
    puts ("++                       ???????????????                     ++");
    puts ("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
    puts ("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
	
	puts ("\n======================== Start Of Main ========================\n");

	LongIntArray 
		Data1, Data2;

 	Data1.Max = 1000;
 	Data1.ActNo = 0;
 	Data2.Max = 1000;
 	Data2.ActNo = 0;

	FillLongIntArrayRandom(Data1, 1, 100, 10);
 	DisplayLongIntArray(Data1, "Data1 Before The Sort");
//	SelectionSort(Data1);
// 	InsertionSort(Data1);
// 	Shell(Data1);
// 	Quick(Data1);
	DisplayLongIntArray(Data1, "Data1 After The Sort");

	FillLongIntArrayRandom(Data2, 1, 300, 100); 
 	DisplayLongIntArray(Data2, "Data2 Before The Sort");
//	SelectionSort(Data2);
//	InsertionSort(Data2);
// 	Shell(Data1);
// 	Quick(Data1);
	DisplayLongIntArray(Data2, "Data2 After The Sort");

	puts ("\n========================= End Of Main =========================\n");
    return (0);
}


////////////////////////////////////////////////////////////////////////////////// 
//////////////////////////////////////////////////////////////////////////////////
//                                                                              // 
//                           FillLongIntArrayRandom                             // 
//                                                                              // 
//  Purpose    : Fills the array with noItems random elements; each of the      //
//               elements are between low and high parameters (including these  //
//               endpoints).                                                    // 
//               FillLongIntArrayRandom (Data1, 1, 8, 50) should                //
//                    (1) Fill Data1.Info with 50 values { 1,2,3,4,5,6,7,8 }    //
//                    (2) Fill Data1.ActNo with 50.                             // 
//                    (3) Place the first random number in Info[1], the second  // 
//                         in Info[2], etc.                                     // 
//                    (4) If the NoItems is 12, then ActNo is to be set to 12   // 
//                        during this Fill routine; the valid data will be in   // 
//                        elements 1-12 of Info.                                // 
//                    (5) Do not put data in Info[0].                           // 
//               You don't have to do error checking, but extra credit if you   //
//               it well.                                                       //
//                                                                              // 
//  Written By : ?????????????           Environment : Windows Vista            //
//  Date       : ??/??/????              Compiler    : Visual Studio Net 2008   // 
////////////////////////////////////////////////////////////////////////////////// 
//////////////////////////////////////////////////////////////////////////////////
void FillLongIntArrayRandom(LongIntArray &LongInt, int Low, int High, int NoItems)
{
long
	Pos;
}


////////////////////////////////////////////////////////////////////////////////// 
//////////////////////////////////////////////////////////////////////////////////
//                                                                              // 
//                           DiplayLongIntArray                                 // 
//                                                                              // 
//  Purpose    : Displays the long int array with formatted display.            // 
//                                                                              // 
//  Written By : Dr. Thomas E. Hicks     Environment : Windows Vista            //
//  Date       : ??/??/????              Compiler    : Visual Studio Net 2008   // 
////////////////////////////////////////////////////////////////////////////////// 
//////////////////////////////////////////////////////////////////////////////////
void DisplayLongIntArray (LongIntArray LongInt, char Message[])
{
long 
	Counter;

	printf("%s\n", Message);
	for(Counter = LongInt.ActNo; Counter >= 1; Counter--)
	{
		printf("      |----------|\n");
		printf("%5d |%9d |\n", Counter, LongInt.Info[Counter]);
	}
	if (LongInt.ActNo == 0)
		puts("\n\n\n=========> This Array Is Empty!\n");
	else
		printf("      |----------|\n");
	printf("           Info       ActNo = %d      Max = %d\n", LongInt.ActNo, LongInt.Max);
	printf("\n");
}

5] If you are doing the Insertion Sort, put the following calls in main:

   InsertionSort(Data1);
   InsertionSort(Data2);

6] If you are doing the Selection Sort, put the following calls in main:

   SelectionSort(Data1);
   SelectionSort(Data2);

7] If you are doing the Shell Sort, put the following calls in main:

   Shell(Data1);
   Shell(Data2);

8] If you are doing the Quick Sort, put the following calls in main:

   Quick(Data1);
   Quick(Data2);

 


When Finished!

1] Spot Check!

2]  Place a copy folder FirstSort to the To Be Graded of each team member on Ananke.

3] Backup this project on your Y drive. Back up this project on a thumb drive or your personal computer.


4] Those Labs labeled "Individual Assignment" are to be done separately by each individual. Using a pen,  each individual is to print  his/her Title at the top of this document in the space provided and sign it.  Those Labs labeled "Team Assignment" may be done as a team or individually. Using a pen,  each individual on the team is to print print his/her Title at the top of this document in the space provided and sign it.

Submit only one copy of team assignments!


Turn in the following:

A] Copy of first page of this assignment sheet. Using an ink pen, print your Name and sign this lab at the top. Record the amount of time you spent working on the lab.

B] Listing Main.cpp

C] Make sure your files are on Ananke when you submit this lab

D] Never place your only copy of your project just on Ananke. Never leave a copy of your project on a public server. Always maintain a copy your project to your Y drive. Always maintain a copy your project on your personal computer.

E] Nothing will be graded until this lab form is submitted.  Staple the pages. Fold the lab Horizontally (like a hot dog) and write your name nice and large on the outside.  Place it on the professor desk before the beginning of lecture on the day it is due. All assignments are due the next class period unless otherwise designated on the schedule page.