Bubble Sort Algorithm Implementation - 2019 Instruction
Hello To everyone I'm Boss of the high-program, today I collect some information about Bubble Sort Algorithm Implementation - 2019 Instruction, I will show you how to Bull sort Algorithm, Don worry I will show you all information.
If you want more information about everything I will post you, all article is written by High-program.blogspot.com
#include<stdio.h>
int main()
{
int i, j, n, temp, data[10];
printf("Enter total numbers to be sorted:");
scanf("%d",&n);
//This program will be able to sort max 10 numbers.
for(i=0; i<n; i++)
{
printf("Enter data[%d]:",i);
scanf("%d",&data[i]);
}
printf("Unsorted data:");
for(i=0; i<n; i++)
printf("%d, ", data[i]);
for(i=0; i<n; i++)
{
for(j=0; j<n-i-1; j++)
{
if(data[j] > data[j+1])
{
temp = data[j];
data[j] = data[j+1];
data[j+1] = temp;
}
}
}
printf("\nSorted data:");
for(i=0; i<n; i++)
printf("%d, ", data[i]);
return 0;
}
The output of the program:
Enter total numbers to be sorted:5
Enter data[0]:1
Enter data[1]:3
Enter data[2]:2
Enter data[3]:4
Enter data[4]:5
Unsorted data:1, 3, 2, 4, 5,
Sorted data:1, 2, 3, 4, 5,
About Fibonacci series
Each new number in a series is the addition of its previous two numbers.
Example of Fibonacci series(for N = 8)
0, 1, 1, 2, 3, 5, 8, 13
The algorithm to print Fibonacci series up to given number N.
Step 1: Start
Step 2: Declare variables N, N1, N2, N3, i.
Step 3: Read value of N from a user.
Step 4: if N < 2, display message “Enter number > 2” and go to step 9.
Step 5: Initialize variables N1 = 0, N2 = 1, i = 0
Step 6: Display N1, N2
Step 7: Compute N3 = N1 + N2
Step 8: Repeat following statements until i < N - 2
Display N3
N1 = N2
N2 = N3
N3 = N1 + N2
i = i + 1
Step 9: Stop
We Collect some information Bubble Sort Algorithm Implementation, The output of the program, About Fibonacci series, The algorithm to print Fibonacci series up to given number N.
I hope you will learn it, Do you want more information please tell us and we will share as soon, Please share our blog - www.high-program.blogspot.com with Youtube, Facebook, Twitter, Instagram, Telegram, IMO, Whatsapp, RSS feeds, Google Plus, and with Email.
0 Response to "Bubble Sort Algorithm Implementation - 2019 Instruction"
Post a Comment