i need to code a tree sort for c without

FIND A SOLUTION AT Academic Writers Bay

the code below is how I did selection sort, but now I need to do it with Tree Sort algorithm, I need to use that struct and vector. please do not use pointer, node, or class because I haven’t learn it. So the key is to code a Tree Sort algorithm for this project.

#include
#include
#include
#include
#include // clock(); CLOCKS_PER_SEC, clock_t

using namespace std;

//Create a new data type Student
struct Student {
string name;
double score;

};
/* Function Declaration*/
void FillVector(string fileName, vector & studentsList);
void DisplayStudent(vector & studentsList);
void StudentSort(vector & studentsList);
double getMilliSeconds(clock_t c);
void outputStudentsSort(vector & studentsList);

int main()
{
unsigned int t1, t2;
string fileName;
vector studentsList;

cout << “Enter name of the file: “;
getline(cin, fileName);

FillVector(fileName, studentsList);

cout << “nData of students Found in the text file:” << endl;
DisplayStudent(studentsList);

t1 = clock();
StudentSort(studentsList);
t2 = clock();
cout << ” nTime = ” << getMilliSeconds(t2 – t1) << “milliseconds” << endl;

cout << “nData of students sort by scored :” << endl;
DisplayStudent(studentsList);
outputStudentsSort( studentsList);

system(“pause”);
return 0;
}
//Function Definition
void FillVector(string fileName, vector & studentsList) {

ifstream inFS;
string name;
double score;
Student newStudent;

//open file
inFS.open(fileName);

if (!inFS.is_open())
{
cout << ” Could not open the file ” << fileName << endl;
cout << “Press any key …..” << endl;
cin.get();
exit(0);
}

//get information of the file
while (!inFS.eof())
{
inFS >> name >> score;
newStudent.name = name;
newStudent.score = score;
studentsList.push_back(newStudent);
}

//close file
inFS.close();
}
void DisplayStudent(vector & studentsList) {

for (int index = 0; index < studentsList.size(); index++)
{
cout << studentsList[index].name << “t” << studentsList[index].score << endl;
}
}
// Selection Sort by score
void StudentSort(vector & studentsList) {

int minIndex;
double tempScore;
string tempName;
// One by one move boundary of usorted subarray
for (int i = 0; i < studentsList.size() – 1; i++) {

minIndex = i; // minimal element index

for (int j = i + 1; j < studentsList.size(); j++) {

if (studentsList[j].score < studentsList[minIndex].score) {
minIndex = j;
}
}

// Swap the found minimum element with the first element
tempScore = studentsList[i].score;
studentsList[i].score = studentsList[minIndex].score;
studentsList[minIndex].score = tempScore;

tempName = studentsList[i].name;
studentsList[i].name = studentsList[minIndex].name;
studentsList[minIndex].name = tempName;
}

}
void outputStudentsSort(vector & studentsList) {
ofstream OutFS;
OutFS.open(“SelectionSortStudents.txt”);

for (int index = 0; index < studentsList.size(); index++)
{
OutFS << studentsList[index].name << “t” << studentsList[index].score << endl;
}
OutFS.close();
}
double getMilliSeconds(clock_t c) {
double time;
time = (double(c) / CLOCKS_PER_SEC) * 10000;
return time;
}

 

“CUSTOM PAPER”
Order Your Custom Paper
Best Custom Essay Writing Services

QUALITY: 100% ORIGINAL PAPER NO PLAGIARISM – CUSTOM PAPER

Why Choose Us?

  • 100% non-plagiarized Papers
  • 24/7 /365 Service Available
  • Affordable Prices
  • Any Paper, Urgency, and Subject
  • Will complete your papers in 6 hours
  • On-time Delivery
  • Money-back and Privacy guarantees
  • Unlimited Amendments upon request
  • Satisfaction guarantee
SATISTACTION

How It Works

  • Click on the “Place Your Order” tab at the top menu or “Order Now” icon at the bottom and a new page will appear with an order form to be filled.
  • Fill in your paper’s requirements in the “PAPER DETAILS” section.
  • Fill in your paper’s academic level, deadline, and the required number of pages from the drop-down menus.
  • Click “CREATE ACCOUNT & SIGN IN” to enter your registration details and get an account with us for record-keeping and then, click on “PROCEED TO CHECKOUT” at the bottom of the page.
  • From there, the payment sections will show, follow the guided payment process and your order will be available for our writing team to work on it.

About AcademicWritersBay.com

AcademicWritersBay.com is an easy-to-use and reliable service that is ready to assist you with your papers 24/7/ 365days a year. 99% of our customers are happy with their papers. Our team is efficient and will always tackle your essay needs comprehensively assuring you of excellent results. Feel free to ask them anything concerning your essay demands or Order.

AcademicWritersBay.com is a private company that offers academic support and assistance to students at all levels. Our mission is to provide proficient and high quality academic services to our highly esteemed clients. AcademicWritersBay.com is equipped with competent and proficient writers to tackle all types of your academic needs, and provide you with excellent results. Most of our writers are holders of master’s degrees or PhDs, which is an surety of excellent results to our clients. We provide assistance to students all over the world.
We provide high quality term papers, research papers, essays, proposals, theses and many others. At AcademicWritersBay.com, you can be sure of excellent grades in your assignments and final exams.

NO PLAGIARISM
error: Content is protected !!