943,891 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 672
  • C++ RSS
Sep 8th, 2008
0

Help! I need a little help starting this project its my final

Expand Post »
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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sanfan49er is offline Offline
18 posts
since Mar 2008
Sep 8th, 2008
0

Re: Help! I need a little help starting this project its my final

Click to Expand / Collapse  Quote originally posted by sanfan49er ...
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
Featured Poster
Reputation Points: 2614
Solved Threads: 687
Posting Expert
VernonDozier is offline Offline
5,375 posts
since Jan 2008
Sep 10th, 2008
0

Re: Help! I need a little help starting this project its my final

Search for quick sort and bubble sort , this will help you finish your final year project assignment.
Reputation Points: 769
Solved Threads: 128
Banned
ithelp is offline Offline
1,910 posts
since May 2006
Sep 10th, 2008
0

Re: Help! I need a little help starting this project its my final

Go eat a can and put your best effort in to it.
Reputation Points: 20
Solved Threads: 8
Junior Poster in Training
Dannyo329 is offline Offline
79 posts
since Apr 2008
Sep 10th, 2008
0

Re: Help! I need a little help starting this project its my final

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.
Reputation Points: 11
Solved Threads: 6
Junior Poster in Training
MelechM is offline Offline
55 posts
since Sep 2008
Sep 11th, 2008
0

Re: Help! I need a little help starting this project its my final

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!

C++ Syntax (Toggle Plain Text)
  1. private: System::Void btnSort_Click(System::Object^ sender, System::EventArgs^ e)
  2. {
  3.  
  4. lsv->Items->Clear();
  5. int temp;
  6. String^ Stemp;
  7. float ftemp;
  8.  
  9. for ( int i = 1;i < Employee_sum;i++ )
  10. {
  11. for ( int j = Employee_sum- 1; j >= i; j--)
  12. {
  13. if ((employee[j-1]->GetAFM()) > (employee[j]->GetAFM()))
  14. {
  15. temp = employee[j-1]->GetAFM();
  16. employee[j-1]->SetAFM(employee[j]->GetAFM());
  17. employee[j]->SetAFM(temp);
  18.  
  19. Stemp = employee[j-1]->GetLName();
  20. employee[j-1]->SetLName(employee[j]->GetLName());
  21. employee[j]->SetLName(Stemp);
  22.  
  23. Stemp = employee[j-1]->GetFName();
  24. employee[j-1]->SetFName(employee[j]->GetFName());
  25. employee[j]->SetFName(Stemp);
  26.  
  27. temp = employee[j-1]->GetSalary();
  28. employee[j-1]->SetSalary(employee[j]->GetSalary());
  29. employee[j]->SetSalary(temp);
  30.  
  31. ftemp = employee[j-1]->GetTax();
  32. employee[j-1]->SetTax(employee[j]->GetTax());
  33. employee[j]->SetTax(ftemp);
  34.  
  35. ftemp = employee[j-1]->GetIKA();
  36. employee[j-1]->SetIKA(employee[j]->GetIKA());
  37. employee[j]->SetIKA(ftemp);
  38.  
  39. ftemp = employee[j-1]->GetTEBE();
  40. employee[j-1]->SetTEBE(employee[j]->GetTEBE());
  41. employee[j]->SetTEBE(ftemp);
  42.  
  43. ftemp = employee[j-1]->GetNet();
  44. employee[j-1]->SetNet(employee[j]->GetNet());
  45. employee[j]->SetNet(ftemp);
  46. }
  47. }
  48. }
  49. }
Reputation Points: 11
Solved Threads: 12
Junior Poster
Alexpap is offline Offline
117 posts
since Sep 2008
Sep 11th, 2008
0

Re: Help! I need a little help starting this project its my final

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!

C++ Syntax (Toggle Plain Text)
  1. private: System::Void btnSort_Click(System::Object^ sender, System::EventArgs^ e)
  2. {
  3.  
  4. lsv->Items->Clear();
  5. int temp;
  6. String^ Stemp;
  7. float ftemp;
  8.  
  9. for ( int i = 1;i < Employee_sum;i++ )
  10. {
  11. for ( int j = Employee_sum- 1; j >= i; j--)
  12. {
  13. if ((employee[j-1]->GetAFM()) > (employee[j]->GetAFM()))
  14. {
  15. temp = employee[j-1]->GetAFM();
  16. employee[j-1]->SetAFM(employee[j]->GetAFM());
  17. employee[j]->SetAFM(temp);
  18.  
  19. Stemp = employee[j-1]->GetLName();
  20. employee[j-1]->SetLName(employee[j]->GetLName());
  21. employee[j]->SetLName(Stemp);
  22.  
  23. Stemp = employee[j-1]->GetFName();
  24. employee[j-1]->SetFName(employee[j]->GetFName());
  25. employee[j]->SetFName(Stemp);
  26.  
  27. temp = employee[j-1]->GetSalary();
  28. employee[j-1]->SetSalary(employee[j]->GetSalary());
  29. employee[j]->SetSalary(temp);
  30.  
  31. ftemp = employee[j-1]->GetTax();
  32. employee[j-1]->SetTax(employee[j]->GetTax());
  33. employee[j]->SetTax(ftemp);
  34.  
  35. ftemp = employee[j-1]->GetIKA();
  36. employee[j-1]->SetIKA(employee[j]->GetIKA());
  37. employee[j]->SetIKA(ftemp);
  38.  
  39. ftemp = employee[j-1]->GetTEBE();
  40. employee[j-1]->SetTEBE(employee[j]->GetTEBE());
  41. employee[j]->SetTEBE(ftemp);
  42.  
  43. ftemp = employee[j-1]->GetNet();
  44. employee[j-1]->SetNet(employee[j]->GetNet());
  45. employee[j]->SetNet(ftemp);
  46. }
  47. }
  48. }
  49. }
[/QUOTE]
Reputation Points: 11
Solved Threads: 12
Junior Poster
Alexpap is offline Offline
117 posts
since Sep 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: comparing stings to string array values
Next Thread in C++ Forum Timeline: Dynamic array of pointers to structures - doubt





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC