0% found this document useful (0 votes)
44 views11 pages

Theory of Programming Language

The document compares different sorting algorithms like insertion sort, selection sort, quick sort, and bubble sort based on their time and space complexity in C and Java. It finds that quick sort has the best time complexity of O(nlogn) and performs best in terms of execution time in both C and Java compared to other algorithms.

Uploaded by

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

Theory of Programming Language

The document compares different sorting algorithms like insertion sort, selection sort, quick sort, and bubble sort based on their time and space complexity in C and Java. It finds that quick sort has the best time complexity of O(nlogn) and performs best in terms of execution time in both C and Java compared to other algorithms.

Uploaded by

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

A Comparative Study on Different Types of Sorting

Algorithms (On the Basis of C and Java)

Members: Imtiaz Ahmad (MTN-20-12254)


Muhammad Irfan (MTN-20-12279)
Supervised By: Dr. Aiesha Ahmad
Authors:

1. Rekha Dewivedi
PG Scholar
Department of Computer Science & Engg. Indore MP
2. Dr. Danish C. Jain
Reader
Department of Computer Science & Engg. Indore MP
Year of Publish: August 2014
Rekha dwivedi et al./ International Journal of Computer Science & Engineering Technology (IJCSET)
Paper URL: http://www.ijcset.com/docs/IJCSET14-05-08-026.pdf
Agenda:

 Abstract
 Introduction
 Literature Review
 Problem Statement
 Methodology
 Conclusion
 References
ABSTRACT

 Sorting is used for arranging the data in some kind of sequence like increasing
or decreasing order. I have discussed about various sorting algorithm with
their comparison to each other on the basis of time complexity and space
complexity as well as C and Java. This paper shows running time of algorithm
with the help of C and Java language. I have compared some types of sorting
algorithms like insertion sort, selection sort, quick sort and bubble sort by
comparing time complexity and space complexity.
Introduction:

 A. Sorting
Let ‘P’ be a list of ‘m’ elements P1, P2, P3……….Pn in memory. Sorting P
means arranging the contents in either increasing or decreasing order i-e,
P1<P2<P3…..Pn.
 B. Sorting Algorithm
Sorting algorithm is an important task for arranging the elements in the list.
Comparing the various types of sorting in this paper on the basis of C and Java.
Literature Review:
 Insertion Sort.
An insertion sort is one that sorts a set of values by inserting values into an
existing sorted file.
Time Complexity: T(n)=1+2+3+4+………….+(i-1)+…….+(n-1)= n(n-1)/2=O(n)
 Bubble Sort.
In Bubble sort each element is compared with its adjacent element. If the first
element is larger than the second one then the position of elements is
interchanged, other it is not changed.
Time Complexity: T(n)=(n-1)+(n-2)+(n-3)+--------+(n-i)+3+2+1= n(n-1)/2=O(n^2)
 Selection Sort:
In selection sort, the first element of the array is compared with minimum value
of the array and interchanged the position of the element, and so on.
Time Complexity: T(n)=(n-10+(n-2)+(n-3)+,-----,+(n-i)+3+2+1= n(n-1)/2=O(n^2)
Literature Review
 Quick Sort:
Quick sort works by partitioning methods for sorting the array. And each
partition is in turn sorted Recursively. In partition, one element of array is
selected as a pivot value. This pivot value can be the first element of array. The
array elements are grouped into two partition 1. One partition contains elements
that are smaller than pivot value.2.Another partition contains elements that are
larger than pivot value. Time required to partition the array is:
Time Complexity: O(n).
Methodology:

 Tools/software:
1. MS Visual Studio
2. Turbo C++
Conclusion:

 In this article I have studied various sorting algorithm and compared them on
the basis of time complexity, execution time in C and Java language. I used C
and Java program for finding the execution time in the time seconds. I
observed that the execution time for the quick sort is best among all the
Sorting Algorithms and also observed that the execution time in Java is best
than in C.
Future Works:

 This paper may help to the researchers in evaluating the all types of sorting
algorithms by which they could easily find the advantages and disadvantages
of sorting algorithms and also find these applications to the different areas.
THANK YOU

You might also like