Question: This program will sort an array of strings using two different sorting algorithms. of the book. One of your sorts should be written using SELECTION
This program will sort an array of strings using two different sorting algorithms. of the book. One of your sorts should be written using SELECTION SORT. The other should be written with MERGESORT. You must write your own sort code. Do not use any built in C++ libraries for sorting.
Requirements
Prompt the user for the name of the input file.
Read up to 1000 of the words from the file into an array of string. Your program should work for any number of words in a file, from 1 through 1000.
After reading in your array you should make a copy of it so you can apply two sorting algorithms to the data.
Write a selection sort function that takes an array of strings and a length and sorts them ascending (alphanumerically, case insensitive). Print the sorted array to the screen (wrap words after each 5th word).
Write a merge sort that takes the 2nd copy of the original array of strings and sorts them into descending order. Print the sorted array. Sample Input File A data file for this program is simply a file with a bunch of words in it.
Each word is separated by whitespace.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
