Download as pdf or txt
Download as pdf or txt
You are on page 1of 19

RAJARAMBAPU INSTITUTE OF

TECHNOLOGY’S(POLETECHNIC)LOHEGAON PUNE -411047

A PROJECT REPORT

ON

TITLE: - “ VISUAL BUBBLE SORT”

SUBMITED TO

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


INPARTIAL FULFILLMENT OF THE REQUIRMENTS FOR THE AWARD OF
DIPLOMA IN COMPUTER ENGNEERING
BY

1. Mahadev Sakhare
2.Tejas Suryavanshi
3.Sanket Sutar
4.Laxmi Gujar

UNDER THE GUIDANCE OF


Prof. Priyanka Kasare
DEPARTMENT OF COMPUTER ENGINEERING
RAJARAMBAPU INSTITUTE OF TECHNAOLOGY’S (POLYTECHNIC)
LOHEGAON, PUNE-411047(2019-2020)

1
RAJARAMBAPU INSTITUTE OF
TECHNOLOGY’S(POLETECHNIC)LOHEGAON PUNE -411047

CERTIFICATE

This is to certify that, the project entitled “REPORT ON VISUAL


BUBBLE SORT” has been Successfully completed by “ Mahadev
Sakhare ”, impartial fulfillment of the requirement of Engineering
Diploma Program in Computer of Maharashtra State Board of Technical
Education During Academic Year 2020-21.

Project Guide S.Y. Co-Ordinator Principal

(Mrs. Priyanka Kasare) (Vinod Jadhav) (Mr. S. K. Joshi)

2
RAJARAMBAPU INSTITUTE OF
TECHNOLOGY’S(POLETECHNIC)LOHEGAON PUNE -411047

CERTIFICATE

This is to certify that, the project entitled “REPORT ON VISUAL


BUBBLE SORT” has been Successfully completed by “ Tejas
Suryavanshi ”, impartial fulfillment of the requirement of
Engineering Diploma Program in Computer of Maharashtra State Board
of Technical Education During Academic Year 2020-21.

Project Guide S.Y. Co-Ordinator Principal

3
(Mrs. Priyanka Kasare) (Vinod Jadhav) (Mr. S. K. Joshi)

RAJARAMBAPU INSTITUTE OF
TECHNOLOGY’S(POLETECHNIC)LOHEGAON PUNE -411047

CERTIFICATE

This is to certify that, the project entitled “REPORT ON VISUAL


BUBBLE SORT” has been Successfully completed by “ Sanket
Sutar ”, impartial fulfillment of the requirement of Engineering
Diploma Program in Computer of Maharashtra State Board of Technical
Education During Academic Year 2020-21.

Project Guide S.Y. Co-Ordinator Principal

(Mrs. Priyanka Kasare) (Vinod Jadhav) (Mr. S. K. Joshi)

4
RAJARAMBAPU INSTITUTE OF
TECHNOLOGY’S(POLETECHNIC)LOHEGAON PUNE -411047

CERTIFICATE

This is to certify that, the project entitled “REPORT ON VISUAL


BUBBLE SORT” has been Successfully completed by “Laxmi
Gujar ”, impartial fulfillment of the requirement of Engineering
Diploma Program in Computer of Maharashtra State Board of Technical
Education During Academic Year 2020-21.

Project Guide S.Y. Co-Ordinator Principal

(Mrs. Priyanka Kasare) (Vinod Jadhav) (Mr. S. K. Joshi)

5
ACKNOWLEDGEMENT

We have an opportunity to express our deep sense of graduate to Prof.


Mrs. Priyanka Kasare (project guide), Department of Computer for her
valuable guidance and suggestion during the course of this project work.
Her encouragement at all stages has contribution greatly to complete this
project to work systematic manner. We thankful to prof. Mr. Vinod
Jadhav, Head of Department for his continue support to complete this
project work. We thankful to prof. Mr. Joshi S.K, principal of
Rajarambapu Institute of Technology (Polytechnic) Lohegaon, pune-
411047, for allowing us to carry out his project.

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

Sr. Topic Name Page


No. Number
1 Introduction
2 Algorithm
3 Flowchart
4 Source code
5 output
6 Feature
7 Advantage and disadvantage
8 Conclusion

8
INTRODUCTION

Bubble Sort is a sorting algorithm, which is commonly used in


computer science. Bubble Sort is based on the idea of repeatedly
comparing pairs of adjacent elements and then swapping their
positions if they exist in the wrong order

Bubble Sort is a simple algorithm which is used to sort a given set


of n elements provided in form of an array with n number of elements.
Bubble Sort compares all the element one by one and sort them based
on their values.

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.

If we have total n elements, then we need to repeat this process for n-


1 times.

It is known as bubble sort, because with every complete iteration the


largest element in the given array, bubbles up towards the last place
or the highest index, just like a water bubble rises up to the water
surface.

Sorting takes place by stepping through all the elements one-by-one


and comparing it with the adjacent element and swapping them if
required

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).

2. Compare the second and third element to check which one is


greater, and sort them in ascending order.

3. Compare the third and fourth element to check which one is


greater, and sort them in ascending order.

4. Compare the fourth and fifth element to check which one is


greater, and sort them in ascending order.

5. Repeat steps 1–5 until no more swaps are required.

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

Worst and Average Case Time Complexity


O(n*n). Worst case occurs when array is reverse sorted.

Best Case Time Complexity:


O(n). Best case occurs when array is already sorted.

Auxiliary Space: O(1)

Boundary Cases:
Bubble sort takes minimum time (Order of n) when
elements are already sorted.

Sorting In Place: Yes

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

It can be concluded that bubble sort is an effortless


way of sorting the elements of an array, thus having
more time complexity. It is a stable and in-place
algorithm which is most used for introducing the
concept of sorting algorithms.

You might also like