Question
Part A: Selection Sort verses Bubble Sort Benchmark This program will read data from file unsortedData.txt into two identical arrays. Name these arrays selectionArray and
Part A: Selection Sort verses Bubble Sort Benchmark
This program will read data from file unsortedData.txt into two identical arrays.
Name these arrays selectionArray and bubbleArray.
Create a function called selectionSort that sorts the selectionArray data using the selection sort approach. The function should keep track of the number of exchanges made during the selection sort. Write contents of the sorted selection Array to a file named sortedSelectionData.txt and report the number of exchanges done
Next the program should sort the bubbleArray using a function named bubbleSort. Again, keep track of the number of exchanges that the bubble sort requires. Write the output of the sorted bubbleArray to a file named sorted sortedBubbleDatatxt.
Sample console output:
Reading selectionData.txt and copying into selectionArray and bubbleArray
Sorting selectionArray using linear sort
Number of exchanges was XX
Writing selectionArray to file sortedSelectionData.txt
Sorting bubbleArray using bubble sort
Number of exchanges was X
Writing bubbleArray to file sortedBubbleData.txt
The results of the PartA will be a two sorted data files and a screen capture. The data files will contain a data file using the selection sort method and a data file sorted using the bubble sort method. (Note, both files should be identical). Name the screen capture file screenCapturePartA. Upload the files to catalyst
Part B: Linear Search verses Binary Search Benchmark:
Write a program compares the number of steps needed by a Linear search verses steps needed for a binary search.
Program algorithm:
Reads the sortedBubbleData.txt created in PartA into an array name searchArray.
Call a function named linearSearch which uses the linear search method
Use the values 26, 50 and 92 for linear searches and report the number of steps needed
Call a function called binarySearch which uses the binary search method.
Use the values 26, 50 and 92 for do a binary searches and report the number of steps needed
Sample screen output:
Linear search for 26 was x steps. Value was found or not found
Linear search for 92 was y steps. Value was found or not found
Linear search for 50 was z steps. Value was found or not found
Binary search for 26 was x steps. Value was found or not found
Binary search for 92 was y steps. Value was found or not found
Binary search for 50 was z steps. Value was found or not found
Note that the searchArray size should be size 20 and the each search should report if the value being searched for is not found.
Part C: Car Sales Program using Vectors
Create a car sales report.
Use the following values for your data vectors
Salespersons:
"Aleshia", "Evan", "Frank", "Ulysses", "Tyisha", "Eric", "Marge"
CarsSold:
100, 200, 250, 175, 125, 150, 60
Sample of the report to create:
Sales Person Cars Sold % of Sales
Jane 60 5%
Bill 40 2%
James 150 8%
. . .
TopSalesPerson: Jane
Upload your source program file to carSales.cpp and screen capture of your carsReport to Catalyst
UnsortedData.txt 84 74 65 26 37 91 94 44 52 50 50 47 34 61 70 12 59 94 61 32
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started