Plan 10 points: Provide in your solution folder a Flowchart, pseudocode, photo of your hand-written plan, or type-written algorithm about how you plan to solve the below problem.

Filename: UNIT6_Plan_YourLastName.docx

Include programs as requested below.

Deliverable: Zip file of entire solution Folder including the planning file.

Recall that an array is a list of information of the same data type. There are various ways to sort data in programming.

Bubble sort is one such technique that sorts numbers in a list by comparing them 2 at a time and swapping if necessary.

Bubble sort can go Ascending (A to Z. least to greatest), or Descending (Z to A greatest to least)

Study bubble sort here: https://visualgo.net/en/sorting?slide=1 (Links to an external site.)

Be sure to add the attached .h to your .cpp file. DO NOT re-write the array…It lives in the header file.

#include “accounts.h”

Also, refer to the “maxAccounts” variable from the file.

Task:

Create a Folder on your saving location called Unit6_YourLastName_Task_X where “X” is replaced by the respective task number below.

Background – Use the provided accounts.h header file in your new program. Open accounts.h and note its contents.

#include “accounts.h”

Write a function that will sort the accountBalances array using the bubble sort ASC algorithm.

Display the cpuTime used.

//Notes

//Using the cpuTime()

//start of program

cout << “Start: ” << cpuTime() << endl;

//end of program

cout << “End ” << cpuTime() << endl; //document your end time for our Results.txt file.

Create a file called Results.txt. You will use this file to log/write cpuTime() information for the four runs of the program below.

Helpful Reference: Passing Arrays to Functions – Dr_T

https://repl.it/@TysonMcMillan/PassingCPPArraysToF… (Links to an external site.)

Task 1 – Write a pseudocode description and a flowchart for the task in “Background” item 2. What is the process for sorting the array with Bubble Sort ASC. Document this step by step process.

1.

1. Unit6_Pseudocode_Program1_Yourlastname

2. Unit6_Flowchart_Program1_Yourlastname

Task 2 Write Program 1 :Write a program that will do the task defined in your pseudocode:

1.

1. UNIT6_Program1_YourLastName.cpp (or main.cpp)

2. Use Bubble sort to sort the array ASC

3. Print the array output to the screen using: void printArray(int array[], int size);

4. Run the program 3 times

5. Write/type your results in the Results.txt file with the label “Bubble Sort ASC”

Task 3 Write Program 2 :Using program1 as a guide, sort the results in reverse order.

1.

1. UNIT6_Program2_YourLastName.cpp (or main.cpp)

2. Use Bubble sort to sort the array DESC

3. Print the array output to the screen using: void printArray(int array[], int size);

4. Run the program 3 times

5. Write/type your results in the Results.txt file with the label “Bubble DESC”

Task 4 Write Program 3 :Using program1, create an additional function for sorting that uses the standard sort function instead of the bubble sort and call this new method for sorting. See http://www.cplusplus.com/articles/NhA0RXSz/ (Links to an external site.)

How does built-in sort work?

#include <algorithm> //to use the sort command

int main() {

int myArray[7] = {1,2,3,4,5,6,7};

sort(myArray,myArray+7); //sort(nameOfArray,nameOfArray+sizeOfArray); //ASC

}

Be reminded that we know the name of or array is accountsBalances and the size of our array is stored in maxAccounts

sort(accountBalances, accountBalances+maxAccounts);

1. UNIT6_Program3_YourLastName.cpp (or main.cpp)

2. Use built-in sort function to sort the array ASC

3. Print the array output to the screen using: void printArray(int array[], int size);

4. Run the program 3 times

5. Write/type your results in the Results.txt file with the label “Sort Built-in ASC”

Task 5 Write Program 4 :Using program1, create an additional function for sorting that uses the standard sort function instead of the bubble sort and call this new method for sorting.

(Links to an external site.)

How does built-in sort work in reverse (DESC)?

#include <algorithm> //to use the sort command

int main() {

int myArray[7] = {1,2,3,4,5,6,7};

sort(myArray,myArray+7); //sort(nameOfArray,nameOfArray+sizeOfArray); //ASC

reverse(myArray,myArray+7); //call sort first, then reverse the order DESC

}

Be reminded that we know the name of or array is accountBalances and the size of our array is stored in maxAccounts

sort(accountBalances, accountBalances+maxAccounts);

reverse(accountBalances, accountBalances+maxAccounts);

1.

1.

1. UNIT6_Program4_YourLastName.cpp (or main.cpp)

2. Use built-in sort function to sort the array DESC

3. Print the array output to the screen using: void printArray(int array[], int size);

4. Run the program 3 times

5. Write/type your results in the Results.txt file with the label “Sort Built-in DESC”

Task 6 – Finally, in Results.txt write a brief summary about the average speed of each program run. Which program/process ran the fastest on average?

Task 7 – Using zip software, Zip the Entire Unit6_YourLastName folder naming the resulting file Unit6_YourLastName.zip

o How to Compress or Uncompress a file in Windows (Links to an external site.)

Instructions for Submission:

o Upload your UNIT6_YourLastName.zip file

o

In the “written submission/comments” Provide Dr_T the Live URL share of1) Repl.it share URL(4), and remember to include your planning file and the Result.txt file as well. 2) the URL of your GitHub repository If using an IDE other than Repl.it, provide Dr_T with the zip file submission of your code.