#include <stdio.h>
#include <conio.h>
int main()
{
int a[10],i,j,temp=0;
printf("Enter all the 10 numbers");
for(i=0;i<10;i++)
scanf("%d",&a[i]);
for(i=0;i<10;i++) //This loop is for total array elements (n)
{
for(j=0;j<9;j++) //this loop is for total combinations (n-1)
{
if(a[j]>a[j+1]) //if the first number is bigger then swap the two numbers
{
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
}
}
printf("The ordered array is");
for(j=0;j<10;j++) //Finally print the ordered array
printf("%d \t",a[j]);
getch();
return 0;
}
Any data that is keyed to a numeric or text field may be sorted in ascending or descending order. Data that is keyed to a date may be sorted in chronological order (ascending with oldest first) or reverse-chronological order (descending order with newest first). Data that is keyed to a price may be sorted with most-expensive first (descending order) or least-expensive first (ascending order). Data that is keyed to a weight may be sorted in ascending or descending order of weight. And so on.
No. They can be sorted either ways. Ascending or Descending.
Using sorted(array,reverse=True)
All lists are linked lists; there is no such thing as a separate "sorted list". There are algorithms that can sort a list, of course, but they all work on linked lists.
Sorted refers to a collection of items arranged in a specific order, typically ascending or descending, based on a particular attribute, such as numerical value or alphabetical order. Unsorted, on the other hand, describes a collection where items are not organized in any specific sequence, making it more challenging to locate or analyze individual elements. The distinction between sorted and unsorted data is crucial in computer science, particularly in algorithms and data management, as it affects efficiency in searching and processing.
No, it can be sorted either in ascending or descending order.
No, it can be sorted either in ascending or descending order.
Any data that is keyed to a numeric or text field may be sorted in ascending or descending order. Data that is keyed to a date may be sorted in chronological order (ascending with oldest first) or reverse-chronological order (descending order with newest first). Data that is keyed to a price may be sorted with most-expensive first (descending order) or least-expensive first (ascending order). Data that is keyed to a weight may be sorted in ascending or descending order of weight. And so on.
No. They can be sorted either ways. Ascending or Descending.
Using sorted(array,reverse=True)
Ascending means increasing (usually numbers but could be alphabetic). Descending is the opposite. 81, 121, 100, 169, 11, 9, 14; sorted in ascending order is: 9, 11, 14, 81, 100, 121, 169. The letters Q A B T U Y G H, sorted in descending order are: Y U T Q H G B A
Effective Date
Arranges selection in sorted order means placing elements in ascending or descending order based on a specific key or criteria. This involves selecting elements from a set and arranging them in a specified order, such as numerically or alphabetically.
There is nothing that can only be sorted in ascending order - unless the sorting is being done as the data are being generated.
It will be sorted in ascending order.
Ascending is an order in which things can be sorted. Ascending would be going from A to Z or lowest to highest numbers or earliest to latest dates.
The use of sorting information in SQL is to organize database query results. Typically the data can be sorted in either ascending or descending order. The "Order By" command can be used to sort data in SQL by multiple columns.