You are on page 1of 15

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION

ZEAL EDUCATION SOCIETY’S

ZEAL POLYTECHNIC
MICRO PROJECT
Academic year: 2021-22

TITLE OF PROJECT
Write a c program implementing
bubble sort .

Program: Computer Engineering Program code: SYCO-C


Course: Data Structure using ‘C’ Course code:22317

1
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION

Certificate
This is to certify that Mr. /Ms.KAMTHE AMAR VIJAY

Roll No. 66,67,68,70 of 3rd Semester of Diploma in Computer Engineering of Institute, ZEAL
POLYTECHNIC (Code: 0988) has completed the MicroProject satisfactorily in Subject :Data Structure
using C(22317) for the academic year 2022 - 2023 as prescribed in the curriculum.

Place:Narhe Enrollment No: ……………………………………..

Date: ……………………… Exam. Seat No: …………………………………….

Subject Teacher Head of the Department Principal

2
Group Details:

Name of group
Sr.No Roll No Enrollment No. Seat No.
members
1 Atharva Kokane 66 PROJECT
MAKER
2 Gayatri Surgude 67 INFORMATION
PROVIDER
3 Pranav Yadav 68 INFORMATION
PROVIDER
4 Amar Kamthe 70 INFORMATION
PROVIDER

Name of Guide: Prof.Biradar S.S.

3
INDEX

SR.NO. CONTENT PAGE NO.

1
Information (bubble sort) 05

Algorithm 06
2

3 Example 07

4
Program 10

5 12
Advantages and Disadvantages of Bubble Sort

6 12
Conclusion

4
CONTENT

Bubble sort:
 A practical the simplest sorting algorithm is bubble sort. A bubble
sort is an internal exchange sort . This sorting technique is named
bubble because of the logic is similar to the bubble in water. When a
bubble is formed it is small at the bottom and when it moves up it
becomes bigger I.e. bubbles are in ascending order of their size from
the bottom to the top.
 The key idea of the bubble sort is to make pairwise comparisons and
exchange the positions of the pair if they are out of order.
 This sorting method proceeds by scanning through the element one
pair at a time, and swapping any adjacent pairs it finds to be out of
order.
 Bubble sort starts by comparing first element with second element ;
if first element is greater than second element then it will swap both
the elements and the move on to compare second element with third
element and so on .
 Let Array [ Max ] is integer array , N is size of array . Bubble sort is
simplest sorting algorithm where after every pass the largest element
of array bubbles up toward the last place / index . If we have total n
elements in array then to sort all these element we need to repeat
this process for n - 1 times . In each pass , sorting starts from starting
index and end on ( N - Pass - 1 ) element .
 Time complexity of bubble sort in worst case is O(𝑁2),in best case is
O(N) and in Average case is O(𝑁2).
5
Bubble Sort Algorithm:

-Step1. Repeat for pass=1 to N-1.

-Step2. Repeat for j=0 to N-pass-1.

-Step3. If array[j]>array[j+1].

-Step4. Interchange a[j] with a[j+1].

-Step5. print sorted Array.

6
Example:Consider the following list of element and sort it in acending
order using bubble sort.

Pass 1 : Compare j and j+1 and perform swap/no swap operation.

At the end of pass 1, one element is placed at its proper position and that element is
largest element of array which is placed at last position in array.

Pass 2 : Compare j and j+1 and perform swap/no swap operation.

At the end of pass 2, second largest element of array is placed at its proper position.

7
Pass 3 : Compare j and j+1 and perform swap/no swap operation.

At the end of pass 3, Third largest element of array is placed at its proper position.

Pass 4 : Compare j and j+1 and perform swap/no swap operation.

At the end of pass 4, fourth largest element of array is placed at its proper position.

8
Pass 5 : Compare j and j+1 and perform swap/no swap operation.

At the end of pass5 , fifth largest element of array is placed at its proper position . In each
and every pass one element will be placed at its proper position so after pass 5 , we will
get complete sorted array .

9
Program:Program for bubble sort

#include <stdio.h>

int main()
{
int array[100], n, c, d, swap;

printf("Enter number of elements\n");


scanf("%d", &n);

printf("Enter %d integers\n", n);

for (c = 0; c < n; c++)


scanf("%d", &array[c]);

for (c = 0 ; c < n - 1; c++)


{
for (d = 0 ; d < n - c - 1; d++)
{
if (array[d] > array[d+1]) /* For decreasing order use '<' instead of '>'
*/
{
swap = array[d];
array[d] = array[d+1];
array[d+1] = swap;
}
}

1
}

printf("Sorted list in ascending order:\n");

for (c = 0; c < n; c++)


printf("%d\n", array[c]);

return 0;
}

Output:

1
Advantages and Disadvantages of Bubble Sort :

 Bubble sort is easy and simple to implement .


 Elements are swapped in place without using additional temporary storage , so the
space requirement is at a minimum .
 Bubble sort is slow as it takes O ( n ! ) comparison to complete sorting .
 It is not sufficient for large lists .

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.

✮✮✮

1
WEEKLY PROGRESS REPORT
MICRO PROJECT
SR.NO. WEEK ACTIVITY PERFORMED SIGN OF GUIDE DATE

1 1st Discussion and finalization of topic

2 2nd Preparation and submission of Abstract

3 3rd Literature Review

4 4th Collection of Data

5 5th Collection of Data

6 6th Discussion and outline of Content

7 7th Formulation of Content

Editing and proof Reading of Content


8 8th

9 9th Compilation of Report And Presentation

10 10th Seminar

11 11th Viva voce

12 12th Final submission of Micro Project

Sign of the student Sign of the Faculty

1
SEMINAR PRINTOUTS

REFERENCE: www.google.com SOURCES USED: www.google.com

ANEEXURE II

Evaluation Sheet for the Micro Project


Academic Year: 2022-23 Name of the Faculty: Prof. Biradar S. S.
Course:Data structure using ‘C’ Course code:22317 Semester: III
Title of the project:Write a c program implementing bubble sort .

Co’s addressed by Micro Project:

Tick the CO
CO No. Course Outcome Statements
Addressed
CO103.1 Write an algorithm to sort data using a specified sorting method
Explain the working of given sorting method step-by-step with an example and small
CO103.2
data set

Major learning outcomes achieved by students by doing the project


(a) Practical outcome:
1)

(b) Unit outcomes in Cognitive domain:


1) -----------------------------------------------------------------------------------------------------------------

(c) Outcomes in Affective domain:


1) Function as team member
2) Follow Ethics
3) Comments/suggestions about team work /leadership/inter-personal communication (if any)
4) ………………………………………………………………………………………………………………

1
Marks out of 6 for Marks out of 4for
performance in performance in oral/
Roll No Student Name Total out of 10
group activity presentation
(D5 Col.8) (D5 Col.9)

66 Atharva Kokane

67 Gayatri Surgude

68 Pranav Yadav

70 Amar Kamthe

(Signature of Faculty)

You might also like