Professional Documents
Culture Documents
Dsu Project
Dsu Project
A PROJECT REPORT
ON
SUBMITED TO
1. Mahadev Sakhare
2.Tejas Suryavanshi
3.Sanket Sutar
4.Laxmi Gujar
1
RAJARAMBAPU INSTITUTE OF
TECHNOLOGY’S(POLETECHNIC)LOHEGAON PUNE -411047
CERTIFICATE
2
RAJARAMBAPU INSTITUTE OF
TECHNOLOGY’S(POLETECHNIC)LOHEGAON PUNE -411047
CERTIFICATE
3
(Mrs. Priyanka Kasare) (Vinod Jadhav) (Mr. S. K. Joshi)
RAJARAMBAPU INSTITUTE OF
TECHNOLOGY’S(POLETECHNIC)LOHEGAON PUNE -411047
CERTIFICATE
4
RAJARAMBAPU INSTITUTE OF
TECHNOLOGY’S(POLETECHNIC)LOHEGAON PUNE -411047
CERTIFICATE
5
ACKNOWLEDGEMENT
6
ABSTRACT
Sort is an algorithm that arranges all elements of an array,
orderly. Sorting Technique is frequently used in a large
variety of important applications to arrange the data in
ascending or descending order. Several Sorting
Algorithms of a different time and space complexity are
existed and used. This paper provides a novel sorting
algorithm Counting Position sort which is based on
counting the position of each element in an array. We also
compare the Counting Position algorithm with Bubble sort.
7
INDEX
8
INTRODUCTION
If the given array has to be sorted in ascending order, then bubble sort
will start by comparing the first element of the array with the second
element, if the first element is greater than the second element, it
will swap both the elements, and then move on to compare the
second and the third element, and so on.
9
Algorithm
1. In an unsorted array of 5 elements, start with the first two
elements and sort them in ascending order. (Compare the
element to check which one is greater).
10
Flowchart
11
Source Code
#include<stdio.h>
#include<conio.h>
#include<dos.h>
int main()
{ clrscr();
printf("================== this project
creation group member names
===================\n");
delay(2000);
printf("\n1.mahadev sakhare");
delay(1000);
printf("\n2.laxmi gujar");
delay(1000);
printf("\n3.sanket sutar");
delay(1000);
12
printf("\n4.tejas suryavanshi");
delay(1000);
clrscr();
{ int a[100],limit;
int i,j,temp;
printf("Enter total number of elements: ");
scanf("%d",&limit);
printf("Enter array elements: \n");
for(i=0; i<limit; i++)
{
printf("Enter element %3d: ",i+1);
scanf("%d",&a[i]);
}
clrscr();
for(i=0;i<(limit-1);i++)
13
{
for(j=0;j<(limit-i-1);j++)
{if(a[j]>a[j+1])
{
temp=a[j];
a[j]=a[j+1] ;
a[j+1]=temp;
} } }
printf ("array element in ascending order :\n");
for(i=0;i<limit;i++)
printf("\n %d ",a[i]);
printf("\n");
for(i=0;i<(limit-1);i++)
{
for(j=0;j<(limit-i-1);j++)
14
{
if(a[j]<a[j+1]);
{temp=a[j] ;
a[j]=a[j+1];
a[j+1]=temp;
}} }
printf("array element in decending order ");
for(i=0;i<limit;i++)
printf("\n %d ",a[i]);
printf("\n");
getch();
return 0;
}
}
15
Output
13
Features
Boundary Cases:
Bubble sort takes minimum time (Order of n) when
elements are already sorted.
Stable: Yes
Due to its simplicity, bubble sort is often used to introduce
the concept of a sorting algorithm.
2
Advantages and Disadvantages
Advantages :
It does not deal well with a list containing a huge number
of items.
More than the number of comparisons.
The code become complex for large amount of data.
Disadvantages :
Bubble sort is one of the easiest sort algorithm.
It is easy to implement.
Elements are swapped in place, not use extra array.
It is stable and fast
3
CONCLUSION