#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;
}
sort (int N, int *A) {
int i, swap = 1;
while (swap) {
swap = 0;
for (i=0; i<N-1; ++i) {
if (A[i] > A[i+1]) {
swap = 1;
A[i] ^= A[i+1];
A[i+1] ^= A[i];
A[i] ^= A[i+1];
}
}
}
return;
}
what is c laungagee?????e
Use a std::list with std::sort.
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.
InsertNode(NODE **q,int num) { NODE *r,*temp ; temp = *q; r= malloc(sizeof(NODE)); r->data = num; //if it's fisrt node to be inserted if ( *q == NULL num < (*q)->data) { *q = r ; (*q)->link=temp; } else { while(temp) { if ( (num > temp->data) && (num < temp->link->data ) ) { r->link = temp->link; temp->link = r; return; } temp = temp->link; } r->link = NULL; temp->link = r; } }
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
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.
Placing the smallest digit at the top and listing so the digits continue down to the largest number is to sort in ascending order, from, for example, 1 to 10.To place the numbers with the largest at the top and the smallest at the bottom is to sort in descending order, say from 10 to 1.These terms also apply to other sorted data, so a column of words, for example, might be sorted alphabetically in either ascending or descending order, with the first letters listed from A to Z, or from Z to A.