# Selection Sort using C Program

## Selection Sort Algorithm using C

Selection Sort

• Repeatedly searches for the largest value in a section of the data
• Moves that value into its correct position in a sorted section of the list
• Uses the Find Largest algorithm

## Pseudo Code

• Count comparisons of largest so far against other values
• Find Largest, given m values, does m-1 comparisons
• Selection sort calls Find Largest n times,
• Each time with a smaller list of values
• Cost = n-1 + (n-2) + … + 2 + 1 = n(n-1)/2

## Efficiency

• Time efficiency
• Comparisons: n(n-1)/2
• Exchanges: n (swapping largest into place)
• Overall: (n2), best and worst cases
• Space efficiency
• Space for the input sequence, plus a constant number of local variables

In this lesson we will learn how to write a source code in C programming language for doing simple Selection sort using array in ascending order.

Question : Write a c program for Selection sort.

C Example :

# Partner Sites

## SqliteTutorials.com

### Stuff I use to make videos

Windows notebook - http://amzn.to/2ADOPrW

Apple MacBook Pro - http://amzn.to/2AC0WG2

Ubuntu notebook - https://amzn.to/2GE4giY

Desktop - http://amzn.to/2zct252

Microphone - http://amzn.to/2AC1kV0

notebook mouse - http://amzn.to/2BmeZ2d

Screen Recording Software – Camtasia

### Online Courses to learn

Java - https://bit.ly/2H6wqXk

AngularJS - https://bit.ly/2qebsLu

Python- https://bit.ly/2Eq0VSt

Android - https://bit.ly/2qaRSAS

Linux - https://bit.ly/2IwOuqz

AWS Certified Solutions Architect - https://bit.ly/2JrGoAF

Modern React with Redux- https://bit.ly/2H6wDtA

MySQL - https://bit.ly/2qcF63Z

• Searching for a program code for selection sort using C ? Then on this Ask Expert page, you will get the program you are looking for.