A flow chart can be used to write a program that can sort numbers. The program should be able to sort numbers by either ascending or descending order as needed.
You cannot arrange an array in two orders at the same time. To arrange them in ascending order, sort the elements using an appropriate sorting algorithm. To reverse the order, work inwards from both ends of the array, swapping the elements as you go.
Input the numbers into an array, sort the numbers in descending order, then print the results. If there are fewer than, say, 20 numbers, then a bubble sort will suffice. Otherwise use a more advanced sorting algorithm such as quick sort.
Use the qsort() function ;)
Analyze the problem! Do it by your self for you to learn! -Your computer programming professor
Use a std::list with std::sort.
das
You cannot arrange an array in two orders at the same time. To arrange them in ascending order, sort the elements using an appropriate sorting algorithm. To reverse the order, work inwards from both ends of the array, swapping the elements as you go.
Input the numbers into an array, sort the numbers in descending order, then print the results. If there are fewer than, say, 20 numbers, then a bubble sort will suffice. Otherwise use a more advanced sorting algorithm such as quick sort.
sorry
Use the qsort() function ;)
Analyze the problem! Do it by your self for you to learn! -Your computer programming professor
Use a std::list with std::sort.
An algorithm is the statement of the methodology used to solve a problem. A program is the implementation of that algorithm.
(sort '(3 2 1) #'
Write a program to input values into an array and sort the array in descending order. Size of array is 10.An algorithm to sort a list in ascending order is given below:for( i = 0 to n-2)for(j=i+1 to n-1)if(array[i] > array[j])swap the values of array[i] and array[j]ï‚· Array index starts from 0.ï‚· n is the size of the arrayï‚· Swapping is interchanging the values of two variables. Search the internet for algorithmto swap the values of two variables.ï‚· This is bubble sort algorithm
Put the numbers in a vector and sort the vector. Then print it.