subject

In many computer applications that process any kind of numbers, sorting numbers in either ascending or descending order is an essential function. One of the earliest and easiest techniques to sort numbers is bubble sort. The bubble sort algorithm gets its name from the fact that individual numbers in the array being sorted are bubbled to the top of the list as the sort progresses. The rules for bubble sorting are as follows: Ascending Sort:
1. Test only two numbers at a time, starting with the first two numbers.
2. If the top number is smaller, leave as is. If the top number is larger, switch the two numbers in the array.
3. Go down one number and compare that number to the number that follows it. These two will be a new pair.
4. Continue this process until no switch has been made in an entire pass through the list. Descending Sort: All steps are the same as ascending sort except for Step #2. 2 If the top number is larger, leave as is. If the top number is smaller, switch the two numbers, Your job is to write a program that takes 10 integers in no particular order and sort them in both ascending and descending order. The program output should display 3 lists of the numbers, unsorted, in ascending order, and in descending order. Your program should generate 10 random numbers in between 1 and 100 for sorting.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 18:00
What is the first view you place in your drawing?
Answers: 1
question
Computers and Technology, 23.06.2019 01:00
Petrică, tânăr licean în clasa a ix-a, a primit în dar de la părinţii săi un cont bancar pentru micile sale cheltuieli curente. el este pasionat de internet banking şi îşi verifică cu grijă toate tranzacţiile efectuate. pentru creşterea securităţii tranzacţiilor online, banca îi furnizează lui petrică un număr pe care el va trebui să îl modifice, obţinând un număr tan – număr de autentificare a tranzacţiei (transaction authentication number). regula de obţinere a numărului tan este următoarea: se formează cel mai mic număr par din toate cifrele numărului furnizat de bancă. cerinţă cunoscând numărul n furnizat de bancă, să se determine numărul tan obţinut de petrică. date de intrare fişierul tan.in conţine pe prima linie numărul natural n cu semnificaţia din enunţ. date de ieşire fişierul de ieşire tan.out va conţine o singură linie pe care va fi scris numărul tan cerut. restricţii • 0 < n < 18*1018 • n are cel puţin o cifră pară • numărul tan obţinut nu poate conţine zerouri nesemnificative
Answers: 2
question
Computers and Technology, 23.06.2019 06:00
How can a user delete a drawing object
Answers: 1
question
Computers and Technology, 23.06.2019 22:00
Technician a says engine assemblies can be mounted longitudinally in a chassis. technician b says engine assemblies can be mounted transversely in a chassis. who is correct?
Answers: 2
You know the right answer?
In many computer applications that process any kind of numbers, sorting numbers in either ascending...
Questions
question
Mathematics, 30.06.2019 11:10
question
Social Studies, 30.06.2019 11:10
Questions on the website: 13722367