DOWNLOAD PROGRAM MORE DATA STRUCTURE PROGRAM IN C CODING: #include <stdio.h> #define MAX 8 int main() { int data[MAX]; int i, j, n, c; printf("\nEnter the data"); for (i = 0; i < MAX; i++) { scanf("%d", &data[i]); } n = MAX; do { for (i = 0; i < n - 1; i++) { if (data[i] > data[i + 1]) { data[i] = data[i] + data[i + 1]; data[i + 1] = data[i] - data[i + 1]; data[i] = data[i] - data[i + 1]; } } n = n - 1; for (i= MAX - 1, c = 0; i >= c; i--) { if(data[i] < data[i - 1]) { data[i] = data[i] + data[i - 1]; data[i - 1] = data[i] - data[i - 1]; data[i] = data[i] - data[i - 1]; } } c = c + 1; } while (n != 0 && c != 0); printf("The sorted elements are:"); for (i = 0; i < MAX; i++) { printf("%d\t", data[i]); } }
FOR BEGINNER PROGRAMMER & COMPUTER SCIENCE STUDENTS