Question: C++ Assignment 1 Write three short programs that implement the Bubble Sort, Selection Sort, and Insertion Sort algorithms. Each of these programs will read up
C++



Assignment 1 Write three short programs that implement the Bubble Sort, Selection Sort, and Insertion Sort algorithms. Each of these programs will read up to 1000 integers, sort them, and then print them in a formatted fashion. 1. Initial Setup 1. Log in to Unix. 2. Run the setup script for Assignment 1 by typing: setup 1 2. Input Each program you write should read from standard input using input redirection. Input files for this assignment will contain a series of integers separated by whitespace. 3. Files We Give You The setup script will create the directory Assign1 under your csci241 directory. It will copy a makefile named makefile to the assignment directory and will also create symbolic links to a number of sample data files that you can use to test your programs. You should assume that we will test your programs using data files other than the ones supplied as part of this assignment. Using the makefile we give you, you can build one specific program or build all three programs. To build a single specific program, run the command make followed by the target name for the program that you want to build (bubble_sort, selection_sort, or insertion_sort). For example: z123456@turing: $ make bubble_sort To build all three programs, run the command make all or just make. Running the command make clean will remove all of the object and executable files created by the make command. The data files are named random6.txt, random8.txt, random16.txt, etc., with the numeric part of the file name specifying the number of random values that the file contains. 4. Files You Must Write You will write three files for this assignment: bubble_sort.cpp - This file should contain your solution that uses the bubble sort algorthm. selection_sort.cpp - This file should contain your solution that uses the selection sort algorthm. insertion_sort.cpp - This file should contain your solution that uses the insertion sort algorthm. The three files will obviously contain a great deal of identical code. 5. Output The output should print 8 sorted numbers per line (of course the last line may have less than 8 numbers), nicely aligned in columns Numbers should be right-aligned. Use the setu manipulator to print numbers with a width of 8 characters, padded with leading spaces. Print a newline character ( ) at the end of each line. The output should look like this: z123456@turing:~/csci241/Assign1$ ./bubble_sort
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
