Question

Selection Sort

03 Nov 2017
Answer :
Word Count : 748

Once again, here are the formulas we derived for the number of comparisons and swaps the Selection Sort requires in the worst case. The number of items to be sorted is represented by n.

# of swaps = (n-1)

# of comparisons = (n-1) + (n-2) + ... + 1

Notice that the formula for the number of comparisons is a summation, a series of terms added together. Each term represents the comparisons from one step of our sort. As we increase the number of items to be sorted, we also increase the number of terms in our formula. For example, suppose we were sorting six items and we wanted to know the maximum number of comparisons needed to sort them (i.e. the worst case). Here is how we would find the answer.

First, we write out the correct number of terms in our formula. Remember that n = 6

____ ______ ________ _________ _________ ________.
___ _____ ______ __________ ________ ________ _________ ________ ___.
__________ _____ ____ ____ ______.
_____ ________ ______ ________ ____ _________ ____ _____ ______ __________ ___.
_______ ______ ______ ________ ________ __________ _________.
_______ ____ __________ _____ ____ ___.
_________ __________ _____ ____ ______ ________ ______ ____ _______ _____.
_____ _________ _________ _______ ____ ____ _________ _________.
_____ _______ ________ ________ _______ ________ _____ ____ ______.
____ _________ _______ _____ ___ _________ ________ ___ ___ ____.
___ ________ _____ _________ _____ _____ _________ _________ ______ _______.
_________ ____ _______ _________ __________ _________ __________ _______ __________ ___ _________.
___ _________ _________ ___ ______ _________ __________ ______ _____ ______ ___ _________.
____ _____ __________ _________ ________ ____ ______ _______ _____ _____ ____ _____.
_____ ___ _______ ________ __________ ______ ___ ________.
________ _____ __________ ______ __________ _______.
______ ________ _____ __________ ____ _________ __________ ________ _______.
____ _______ _________ ______ _______.
__________ ________ _________ ______ ______ ___ ________ ___ ___.
____ ________ ___ ____ ________ _________ ______.
________ ___ ___ _______ ___ ______ ____ _____ ______ __________ _____.
______ ___ _____ ___ __________ ______ ______.
__________ ___ _______ _____ _________ ___ ______ ___ ____ ________.
____ _____ ______ __________ ____ _____ _______ _______ __________ __________ _____.
_______ ______ ______ ___ ______ _______ __________ _______ _________ _____.
__________ ____ _______ _____ __________.
__________ ___ ________ ______ ___ ________.
____ _____ __________ ____ _______ ________.
_______ ____ ___ _____ ____ ________ ________ _______ _________ ___ ________.
___ _____ ____ _____ _________ ______ __________ ___ _______ ____ _____ _________.
____ __________ _____ __________ ____ __________ ____ ________.
____ _____ __________ _________ ___ __________.
_______ ____ _________ _____ __________ __________ ____ ______ ________ ____ _____.
____ ________ __________ __________ ________ ________ _________.
__________ ______ ____ __________ _______ ____.
______ ____ ____ _________ _______ ___ __________ ________ ________ ___ _______ _______.
______ ________ _______ _____ __________ _________ ______ _____ _______ ___.
__________ ______ ________ ___ __________ ___.
________ ______ ________ _____ _______ ____ ________ _____ __________ _______ _________.
___ ___ __________ ________ __________.
_________ ___ _____ ___ ________ ______ ______ __________ ____ ___ __________.
_______ _______ ___ _________ __________.
______ _____ ________ __________ __________.
_________ ___ _________ _____ ____ ___ _________ ___ _________ _________ ________ ____.
________ __________ ________ ___ __________ _____.
____ ______ _____ ________ __________ ____ ________ __________ _____ ______ ______ ___.
___ _________ ________ ___ ________ ________ ______ _________ ______.
___ _______ ___ _______ _____ ____ ___ ______ _______ ___ _________ _______.
____ _________ _______ _________ _______ __________ _________.
_____ _________ ________ _________ _______.
______ ________ __________ _____ _____ __________.
________ __________ __________ ___ ___ _________ _____ _________ ___ ______ ___ ________.
__________ _________ ______ ______ _______ _____ ________ _____.
_______ _______ ____ ___ __________ _____ _____ ________ ____.
____ __________ ___ _______ _________ ________ ____.
____ ____ _____ ________ _______ ________ _____ __________ ____.
___ ___ __________ _______ _____ ___ __________.
_____ ____ ________ ___ ______ ___ _______ _________ ________ ___.
______ ________ _______ _____ ________ ____ _____ ____ _________.
______ __________ ____ _____ ____ ___ _____.
______ _________ ______ __________ _______ __________ ____ ______ _____.
___ ____ _____ __________ ________ ____ ____ ___ ______ __________ __________ _____.
______ ___ _______ __________ ____ ___ ________ _______ ________ ______.
_______ ______ ___ ___ _____ ____.
_________ ___ ____ _______ __________ ____.
________ ________ ____ ___ ________ __________ _________ _______ _____ __________.
________ _______ ____ ___ ________ _______ __________.
______ _________ _______ ___ ______ ________.
________ __________ _____ _______ ____ _______ ______ _________ ______ ________ _________ _____.
________ __________ ________ ______ ______ _______ _______ __________ _________ ________ _________.
IGNOU ACADEMY
Your IGNOU journey, made easier.
  • Solved Assignments
  • Study Notes
  • Guess Papers
  • Question Papers
Skip in 10
Top
📞
Call Support Instant phone assistance IGNOU MCS 31 2011 - Selection Sort | IGNOU Academy
→
🟢
WhatsApp Chat Fast live messaging
→
Email Us Business enquiries & support
→