CIS350 Project
Choose one O(n log n) and one O(n2) sorting algorithm. Choose a third algorithm of any time complexity. For each of the three algorithms you have chosen, implement the algorithm.
Then, write a short piece of code that will generate the following:
1. A file of 1000 random integers
2. A file of 10000 random integers
3. A file of 100000 random integers
Run your three sorting routines and, using C++ library functions, time the execution of each of the three routines on the three data sets. Graph the results. Then, write a brief analysis and summary of the results.

Recommended Answers

All 6 Replies

CIS350 Project
Choose one O(n log n) and one O(n2) sorting algorithm. Choose a third algorithm of any time complexity. For each of the three algorithms you have chosen, implement the algorithm.
Then, write a short piece of code that will generate the following:
1. A file of 1000 random integers
2. A file of 10000 random integers
3. A file of 100000 random integers
Run your three sorting routines and, using C++ library functions, time the execution of each of the three routines on the three data sets. Graph the results. Then, write a brief analysis and summary of the results.

What's the question? No one is going to do the whole thing for you without any effort on your part.
http://www.daniweb.com/forums/announcement8-2.html

Search for quick sort and bubble sort , this will help you finish your final year project assignment.

Go eat a can and put your best effort in to it.

Try and start it at least. I think an array of a bunch of numbers would work fine, user inputs the amount of numbers to be generated (to show your professor it works you can input 1000, 10000, and 100000) and then the output is a bunch of numbers from the array.

try the following for a buble sort Ascenting. I think that will help you.All im doing is swaping the values, just like a swap algorithm.

Happy Coding!

private: System::Void btnSort_Click(System::Object^  sender, System::EventArgs^  e) 
		 {

lsv->Items->Clear();
int temp;
String^ Stemp;
float ftemp;

for ( int i = 1;i < Employee_sum;i++ )
{
  for ( int j = Employee_sum- 1; j >= i; j--)
  {
if ((employee[j-1]->GetAFM()) > (employee[j]->GetAFM()))
{
				temp = employee[j-1]->GetAFM();
				employee[j-1]->SetAFM(employee[j]->GetAFM());
				employee[j]->SetAFM(temp);

				Stemp = employee[j-1]->GetLName();
				employee[j-1]->SetLName(employee[j]->GetLName());
				employee[j]->SetLName(Stemp);

				Stemp = employee[j-1]->GetFName();
				employee[j-1]->SetFName(employee[j]->GetFName());
				employee[j]->SetFName(Stemp);

				temp = employee[j-1]->GetSalary();
				employee[j-1]->SetSalary(employee[j]->GetSalary());
				employee[j]->SetSalary(temp);

				ftemp = employee[j-1]->GetTax();
				employee[j-1]->SetTax(employee[j]->GetTax());
				employee[j]->SetTax(ftemp);

				ftemp = employee[j-1]->GetIKA();
				employee[j-1]->SetIKA(employee[j]->GetIKA());
				employee[j]->SetIKA(ftemp);

				ftemp = employee[j-1]->GetTEBE();
				employee[j-1]->SetTEBE(employee[j]->GetTEBE());
				employee[j]->SetTEBE(ftemp);

				ftemp = employee[j-1]->GetNet();
				employee[j-1]->SetNet(employee[j]->GetNet());
				employee[j]->SetNet(ftemp);
				}
	}
	}
}

try the following for an Ascenting buble sort . I think that will help you.All im doing is swaping the values, just like a swap algorithm.

Happy Coding!

private: System::Void btnSort_Click(System::Object^  sender, System::EventArgs^  e) 
         {

lsv->Items->Clear();
int temp;
String^ Stemp;
float ftemp;

for ( int i = 1;i < Employee_sum;i++ )
{
  for ( int j = Employee_sum- 1; j >= i; j--)
  {
if ((employee[j-1]->GetAFM()) > (employee[j]->GetAFM()))
{
                temp = employee[j-1]->GetAFM();
                employee[j-1]->SetAFM(employee[j]->GetAFM());
                employee[j]->SetAFM(temp);

                Stemp = employee[j-1]->GetLName();
                employee[j-1]->SetLName(employee[j]->GetLName());
                employee[j]->SetLName(Stemp);

                Stemp = employee[j-1]->GetFName();
                employee[j-1]->SetFName(employee[j]->GetFName());
                employee[j]->SetFName(Stemp);

                temp = employee[j-1]->GetSalary();
                employee[j-1]->SetSalary(employee[j]->GetSalary());
                employee[j]->SetSalary(temp);

                ftemp = employee[j-1]->GetTax();
                employee[j-1]->SetTax(employee[j]->GetTax());
                employee[j]->SetTax(ftemp);

                ftemp = employee[j-1]->GetIKA();
                employee[j-1]->SetIKA(employee[j]->GetIKA());
                employee[j]->SetIKA(ftemp);

                ftemp = employee[j-1]->GetTEBE();
                employee[j-1]->SetTEBE(employee[j]->GetTEBE());
                employee[j]->SetTEBE(ftemp);

                ftemp = employee[j-1]->GetNet();
                employee[j-1]->SetNet(employee[j]->GetNet());
                employee[j]->SetNet(ftemp);
                }
    }
    }
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.