Ask a question from expert

Ask now

Database Programming Assignment

7 Pages863 Words325 Views

Added on  2019-10-01

Database Programming Assignment

   Added on 2019-10-01

BookmarkShareRelated Documents
Blog: Selection Sort (Databaseprogramming)1
Database Programming Assignment_1
Selection Sort (Database programming)6th August 2019Selection Sort AlgorithmThe selection sort algorithm can be referred to as the process through which values are sorted. For sorting a data in the ascending order, a comparison is undertaken between the 0th element andthe other elements. If it is found that the 0th element is greater in value than the element it is being compared with, there is an interchange between the two values. What happens here is that, after the first iteration occurs, the element with the smallest value is placed at the 0th position. The process is undertaken continuously until there is sorting out of the entire array. Selection sortcan be defined as the simplest sorting algorithm. It first finds out the smallest element within the array and then it swaps that element with the one in the first position. After that, it searches for the second smallest element and will swap it with the element in the second position. This process will be continued till the whole array has been sorted. The figure that is represented below depicts the technique in which the selection sort takes place.2
Database Programming Assignment_2
An example of the process through which selection sort is done in programming is as follows:#include<iostream>usingnamespace std;int main(){int a[100], i, n, p, k, min, loc, tmp; cout <<"\n------------ SELECTION SORT ------------ \n\n";3
Database Programming Assignment_3

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
Sorting and Search Algorithms in C Programming


Sorting Algorithms