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, 22.06.2019 19:00
In he example code, what does the title attribute create? a tool tip an element a source a markup
Answers: 1
question
Computers and Technology, 22.06.2019 21:00
Which of these is most responsible for differences between the twentieth century to the twenty-first century?
Answers: 2
question
Computers and Technology, 23.06.2019 10:00
Whats three fourths of 15(this is supposed to be in math but i clicked too fast)
Answers: 1
question
Computers and Technology, 24.06.2019 10:30
Which of the following types of software is most applicable to the promotion of new products through advertising? a.databases b. spreadsheets c. web design programs d. word processing tools
Answers: 2
You know the right answer?
Write a program that creates three identical arrays, list1, list2, and list3 of 5000 elements. The p...
Questions
question
History, 13.05.2021 02:30
question
Mathematics, 13.05.2021 02:30
question
Mathematics, 13.05.2021 02:30
question
Mathematics, 13.05.2021 02:30
Questions on the website: 13722359