0% found this document useful (0 votes)
7 views20 pages

DSU Microproject

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views20 pages

DSU Microproject

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 20

Diploma Course in Computer

Engineering (As per directives of I


Scheme, MSBTE)

A
MICROPROJECT REPORT
ON

“Sorting Operation ”

Subject - DSU

SUBMITTED
BY

Roll No Name Branch


1121 Abhishek
Mundhe
1122 Bhumika Nallulu CO3I
1123 Harsh
Nandgaonkar
1124 Mayuresh
Nirbhavane
1125 Ozas Patel
PART A – PLAN

Topic of the Microproject: Sorting Operation

BRIEF INTRODUCTION: -

Sorting is one of the operations which we can perform on data structure to arrange data
elements in ascending and descending order. It is a process of rearranging data elements
in an array or list in order to make it easier to search and retrieve. By sorting in data
structure, the complexity of searching for a particular item is reduced.

AIM OF THE MICROPROJECT

 Selection and identification of the system to be studied.


 Designing and development of the system.
 We will also be highlighting the advantages and disadvantages
of sorting for various applications.
 The purpose of this project is to find out which sorting
algorithm works the best for your data structure with program
codes as examples.
RESOURCES REQUIRED-

Name of
Sr. No. Specifications QTY Remarks
Resources

Hardware:
1. Computer CPU - Ryzen 3 1200
system RAM - 8 GB For all
Storage Required - At Practical
As per
most 1 GB of Test
batch
size Case
genera-
tion.
2. Operating
system Windows 10 Pro

3. Software
Microsoft Word 2010 or above
for report
Any photo editing software to
create cover page
PART B – PLAN

Topic of the Project : Sorting Operation

BRIEF INTRODUCTION:-

Sorting is one of the operations which we can perform on data structure to arrange data
elements in ascending and descending order. It is a process of rearranging data elements
in an array or list in order to make it easier to search and retrieve. By sorting in data
structure, the complexity of searching for a particular item is reduced.

AIM OF THE MICROPROJECT-

 Selection and identification of the system to be studied.


 Designing and development of the system.
 We will also be highlighting the advantages and disadvantages
of sorting for various applications.
 The purpose of this project is to find out which sorting
algorithm works the best for your data structure with program
codes as examples.
COURSE OUTCOME INTEGRATED-

Finding information about the sorting algorithms and writing them down.

ACTUAL PROCEDURE FOLLOWED-

 Group Information:

The basic aim of micro project is to accelerate the attainment of the


various outcomes in the cause. In the last two weeks of March the
subject was introduced. The syllabus as well as detail of micro project
was discussed. The groups of 5 members were formed. The schedule
of Plan A & B and presentation were finalized. The various micro
project topic related to subject was discussed.

 Finalization Of Micro Project:

After attending the feature of two weeks, we were able to select the
topic for micro project. We discussed the topic with our guide,
regarding the concept which we are going to apply in the project. We
individually tried to explain the basic platform of project.

 Planning:

From finalizing the project, we, the group members, started working on
the project. We started the planning phase. We discussed among
ourselves regarding the resource such as hardware and software
requirement. In third week of March, we completed the Part A plan of
the microproject.
 Module Distribution And Analysis Part:

Once the planning was over regarding resources etc., we also


finalized the module which we will be designing. According to the
members we distributed the module among them and started the
analysis.

 Design Part:

In this part, we tested the each module and get the actual result for our
micro project. By doing this we were clearer of the project.

 Submission:
First week of October was the submission week, we have to submit the
project to the guide. We have to complete both the Part A and Part B
plan of project. We also have to submit the soft copy of project to the
guide.

This report was created by: Harsh Nandgaonkar


ACTUAL RESOURCES USED-

Name of
Sr. No. Specifications QTY Remarks
Resources

Hardware:
1. Computer CPU - Ryzen 3 1200
system RAM - 8 GB For all
Storage Required - At Practical
As per
most 1 GB of Test
batch
size Case
genera-
tion.
2. Operating
system Windows 10 Pro

3. Software
Microsoft Word 2010 or above
for report
Any photo editing software to
create cover page
Output
Of The
Micro-
Project
Introduction to Sorting:-

What is Sorting?

Sorting is one of the operations which we can perform on data structure to arrange
data elements in ascending and descending order. It is a process of rearranging data
elements in an array or list in order to make it easier to search and retrieve. By
sorting in data structure, the complexity of searching for a particular item is
reduced.

There are different methods that can be used to arrange data in ascending or
descending order.

There are two types of sorting:

1. Internal Sorting:
 Internal Sorting is used when the data to be sort, all stored in main
memory.
 Bubble Sort, Selection Sort, Insertion Sort, Quick Sort, Radix Sort are
internal sorting techniques

2. External Sorting:
 If all the data that is to be sorted do not fit entirely in the main memory,
external sorting is required. An external sort requires the use of external
memory such as disks or tapes during sorting.
 Merge Sort is an example of external sorting
3.
Insertion Sort
Insertion sort is a simple sorting algorithm that builds the final sorted array one
item at a time. It is much less efficient on large lists than more advanced algorithms
such as quicksort, heapsort, or merge sort. However, insertion sort provides several
advantages like simple implementation, efficient for (quite) small data sets,
more efficient in practice than most other simple quadratic algorithms, adaptive,
stable, in-place; i.e., only requires a constant amount of additional memory space,
online; i.e., can sort a list as it receives it

 Insertion Sort Algorithm:


Let Array[Max] is integer array, N is size of array.
1) Repeat for i=1 to N-1.
2) Set temp=Array[i] and j=i-1.
3) While j>=0 and Array[j]>temp do.
4) Array[j+1]=temp.
5) j=j-1.
6) Array[j+1]=temp.

 Program for Insertion Sort:


#include<stdio.h>
#include<conio.h>
#define MAX_SIZE 5
void insertion(int[]);
int main()
{
clrscr();
int arr_sort[MAX_SIZE], i;
printf("Simple Insertion Sort Example - Array and Functions\n");
printf("\nEnter %d Elements for Sorting\n", MAX_SIZE);
for (i = 0; i < MAX_SIZE; i++)
scanf("%d", &arr_sort[i]);
printf("\nYour Data :");
for (i = 0; i < MAX_SIZE; i++)
{
printf("\t%d", arr_sort[i]);
}
insertion(arr_sort);
getch();
}
void insertion(int fn_arr[])
{
int i, j, a, t;
for (i = 1; i < MAX_SIZE; i++)
{
t = fn_arr[i];
j = i - 1;
while (j >= 0 && fn_arr[j] > t)
{
fn_arr[j + 1] = fn_arr[j];
j = j - 1;
}
fn_arr[j + 1] = t;
printf("\nIteration %d : ", i);
for (a = 0; a < MAX_SIZE; a++)
{
printf("\t%d", fn_arr[a]);
}
}
printf("\n\nSorted Data :");
for (i = 0; i < MAX_SIZE; i++)
{
printf("\t%d", fn_arr[i]);
}
}

 Output:

Bubble Sort
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 and bigger i.e. bubbles are in ascending order of their
size from the bottom to the top.

 Bubble Sort Algorithm:


Let Array[Max] is array, N is size of array.
1) Repeat for pass=1 to N-1.
2) Repeat for j=0 to N-pass-1.
3) If array[j]>array[j+1].
4) Interchange a[j] with a[j+1].
5) Print sorted array.

 Program for bubble sort:


#include <stdio.h>
int main()
{
int a[50], n, pass, i, j, temp=0;
setbuf(stdout, NULL);
printf("Enter the value of n: \n");
scanf("%d", &n);
printf("Enter n elements: \n");
for(i=0; i<n; i++)
{
scanf("%d", &a[i]);
}
for (pass=1; pass<n-1; pass++)
{
for (j=0; j<n-pass-1; j++)
{
if (a[j] > a[j+1])
{
temp = a[j];
a[j] = a[j + 1];
a[j + 1] = temp;
}
}
}
printf("The sorted array after Bubble sort is: \n");
for (int i = 0; i < n; i++)
{
printf("%d ", a[i]);
}
return 0;
}

 Output:
Selection Sort
Selection sort performs in-place comparison which means that the array is divided
into two parts, the sorted part at the left end and the unsorted part at the right
end. Initially, the sorted part is empty and the unsorted part is the entire list.

 Selection Sort Algorithm:


Let Array[Max] is array, N is size of array.
1) Repeat for i=0 to N-2.
2) Set min=Array[1] and loc=i.
3) Repeat for j=i+1 to N-1.
4) If min>Array[j] then.
5) Set min=[j] and loc=j;
6) Interchange Array[i] with Array[loc].

 Program for Selection Sort:


#include <stdio.h>
void selectionSort(int arr[], int size);
void swap(int *a, int *b);
/*
* Selection sort function
*/
void selectionSort(int arr[], int size)
{
int i, j;
for (i = 0 ; i < size;i++)
{
for (j = i ; j < size; j++)
{
if (arr[i] > arr[j])
swap(&arr[i], &arr[j]);
}
}
}

/* Function to swap two variables */


void swap(int *a, int *b)
{
int temp;
temp = *a;
*a = *b;
*b = temp;
}

/*
* Main Function
*/
int main()
{
int array[10], i, size;
clrscr();
printf("How many numbers you want to sort: ");
scanf("%d", &size);
printf("\nEnter %d numbers\t", size);
printf("\n");
for (i = 0; i < size; i++)
scanf("%d", &array[i]);
selectionSort(array, size);
printf("\nSorted array after Selection sort is: ");
for (i = 0; i < size;i++)
printf(" %d ", array[i]);
getch();
}
 Output:

Advantages
I. Insertion Sort- It is an in-place sorting algorithm so the space
requirement is minimal.
II. Bubble Sort- It is easy and simple to implement. Elements are swapped
in place without using additional storage, so the space requirement is at
minimum.
III. Selection Sort- It is simple and easy to implement. It gives 60%
performance improvement over bubble sort

Disadvantages
I. Insertion Sort- It is only useful when sorting a list of few items and is
inefficient for large lists.
II. Bubble Sort- It is slow as it takes O(n!) comparison to complete sorting.
III. Selection Sort- It performs poorly when dealing with large number of
elements.
Conclusion –
This microproject has demonstrated the many benefits of using sorting
algorithms for data structure. This microproject has demonstrated that sorting
algorithms are very useful and can significantly improve data sorting.

References –
1) https://www.sanfoundry.com/c-program-implement-selection-sort/

2) https://www.javatpoint.com/bubble-sort-program-in-c

3) https://www.geeksforgeeks.org/sorting-algorithms/

Skill Developed/Learning out of


this Microproject
First and foremost, we learnt to work in a group, share information. Even though
we had a lot of fun, we could learn a great deal from the micro project, than we
would have from the classroom learning. We learnt how to work as a team, and
how to do brain storming. We have learnt how to get the information we need.

You might also like