Question: You will create a dimple Bubble Sort program to sort a string of random integers or text. Please read instructions and examples Please show screenshot
ECE 216 Programming Project 2 The Bubble Sort You will create a simple Bubble Sort program to sort a string of random integers or text or whatever you can punch in from the keyboard. For the input data, you will input a string of single digit ASCII characters, at least 20 of them, in some sort of random order. You aren't limited to 20. Put in 100 if you like. For the output data, you will simply print this string after it is sorted For the process, you will sort the data in either descending order (largest value first smallest value last) or ascending order, but you can allow for both possibilities if you wish In order to sort the data, you will need to develop the algorithm for a bubble sort, thern create a flow chart or pseudocode so you will understand the process, and finally code it. The bubble sort is perhaps the easiest of the sorting algorithms to write. The basic principle is to simply compare two adjacent numbers. If they are in order, then leave them alone and move to the next pair. If they are out of order, swap their positions in memory, and then move onto the next pair Here is a simple example using 5 numbers. Start: 18496 81496 84196 84916 8496 1 compare 8 to 4in order, no swap 89461 89641 compare 1 to 8 compare 1 to 4 compare 1 to 9 compare 1 to 6 out of order, swap them out of order, swap them out of order, swap them out of order, swap them 1st pass: now have: now have: now have: now have: 2nd pass: now have: now have: compare 4 to 9 compare 4 to 6 compare 4 to 1 compare 8 to 9 out of order, swap them out of order, swap them in order, no swap out of order, swap them 3rd pass: now have: 98641 compare 8 to 6 compare 6 to 4 compare 4 to 1 in order, no swap in order, no swap in order, no swap
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
