subject

Write a program that creates three identical arrays, list1, list2, and list3 of 5000 elements. The program then sorts list1 using bubble sort, list2 using selection sort, and list3 using insertion sort and outputs the number of comparisons and item assignments made by each sorting algorithm. I have 2 separate files, functions. cpp and main. cpp
These were given to me by the assignment, which is from Cengage

functions. cpp

#include
#include
#include

using namespace std;

inline void fillArray(int list[], int length)
{
srand(time(0));

for (int i = 0; i
#include
#include
#include "functions. cpp"

using namespace std;

int main()
{
int list1[5000];
int list2[5000];
int list3[5000];

int compBubbleSort = 0, compSelectionSort = 0, compInsertionSort = 0;
int assignBubbleSort = 0, assignSelectionSort = 0, assignInsertionSort = 0;

fillArray(list1, 5000);
copyArray(list1, list2, 5000);
copyArray(list1, list3, 5000);

bubbleSort(list1, 5000, compBubbleSort, assignBubbleSort);
selectionSort(list2, 5000, compSelectionSort, assignSelectionSort);
insertionSort(list3, 5000, compInsertionSort, assignInsertionSort);

cout << "Number of comparisons---" << endl;
cout << " Bubble sort: " << compBubbleSort << endl;
cout << " Selection sort: " << compSelectionSort << endl;
cout << " Insertion sort: " << compInsertionSort << endl << endl;

cout << "Number of item assignments---" << endl;
cout << " Bubble sort: " << assignBubbleSort << endl;
cout << " Selection sort: " << assignSelectionSort << endl;
cout << " Insertion sort: " << assignInsertionSort << endl << endl;

return 0;
}


They expected me to learn everything in 30 days, and the readings were over 30 pages, which would constantly glitch out or have so many spelling/grammatical errors I couldn't understand nor process them. It's overdue now, and I desperately need help. I still don't understand any of the lessons. Help would be extremely appreciated.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 20:30
What important technology has done the most to allow a businesses a chance to compete with larger international companies
Answers: 1
question
Computers and Technology, 22.06.2019 16:30
Which of the following statements best describes it careers?
Answers: 2
question
Computers and Technology, 23.06.2019 09:00
Which is the highest level of the hierarchy of needs model? a. humanity b. intrapersonal c. team d. interpersonal
Answers: 1
question
Computers and Technology, 23.06.2019 15:30
The song about casey jones a railroad engineer who gives his life on the job would most likely gall under the folk song category of? a-work song b-nonsense song c-religious song d-ballad
Answers: 1
You know the right answer?
Write a program that creates three identical arrays, list1, list2, and list3 of 5000 elements. The p...
Questions
question
Chemistry, 27.01.2021 23:20
question
Mathematics, 27.01.2021 23:20
question
History, 27.01.2021 23:20
question
Mathematics, 27.01.2021 23:20
question
Spanish, 27.01.2021 23:20
question
Chemistry, 27.01.2021 23:20
Questions on the website: 13722360