Académique Documents
Professionnel Documents
Culture Documents
Assignment No.E-2
Problem Statement:
Write C++ program to store first year percentage of students in array. Write function for
sorting array of floating point numbers in ascending order using
a) Selection Sort
b) Bubble sort and
Prerequisites
Operating System : Latest version of 64 Bit operating systems open source Ubuntu
14.04
1
4
6
2
0
3
6
1
4
3
2
0
6
3
1
4
2
0
6
1
4
20
6
31
4
1
4
PASS1
62
30
13
4
2
0
2
0
1
4
1
4
PASS2
PASS3
2
2
0
Like this 0continue till all passes
Given array K of N elements, algorithm sorts the elements in
increasing(ascending) order. The variables Pass & Last denote pass counter &
position of last unsorted element respectively. I is index of array elements and
EXCHs is to count no of exchanges made by any pass.
1. (Initialize)
2. Selection Sort
Output
Output in the form of sorted list.
Conclusion
Hence, we have successfully studied concept of bubble sort and selection sort.
Application:
Manly used in manipulating large amount of data. Sometimes used in maintaining file
system.
FAQs :
1.
2.
3.
4.
What is sorting?
What is complexity?
What is complexity of each algorithm?
Analyze the given algorithms after every passes along with no. of comparisons.