Join Our WhatsApp Group Join Subscribe Now!

Data Structure Using C (313301) Practical No.8: Write a ‘C’ Program to Sort an Array of numbers using Selection Sort Method

Data Structure Using C (313301) Practical No.8: Write a ‘C’ Program to Sort an Array of numbers using Selection Sort Method

 Data Structure Using C (313301) Practical No.8: Write a ‘C’ Program to Sort an Array of numbers using the Selection Sort Method

Selection Sort is an in-place comparison sorting algorithm. It divides the input list into two parts: the sublist of items already sorted, which is built up from left to right at the front of the list, and the sublist of items remaining to be sorted that occupy the rest of the list. The algorithm proceeds by finding the smallest (or largest, depending on sorting order) element from the unsorted sublist, exchanging it with the leftmost unsorted element, and moving the sublist boundaries one element to the right.


Algorithm


Flow Chart

Use below information and draw flow chart


C Program Code


Result (Output of Program)

Original array:
64 25 12 22 11 
Sorted array:
11 12 22 25 64 

Practical Related Questions

1. Modify the Selection Sort algorithm to handle arrays containing negative numbers.

Answer:


2. Adapt the Selection Sort algorithm to sort an array of floating-point numbers.

Answer:


Exercise

1. Write Applications of Selection Sort.


2. Compare Selection Sort with Bubble Sort.


Conclusion

We successfully completed Data Structure Using C (313301) Practical No.8 and Wrote a ‘C’ Program to Sort an Array of numbers using the Selection Sort Method.

About the Author

Hi everyone, I'm Suraj Diware, and I'm passionate about helping students succeed in MSBTE programs. This blog is dedicated to providing clear and concise explanations of MSBTE curriculum topics, along with practical tips and resources to sup…

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.