Question

Implement the Insertion Sort algorithm for sorting the following list of numbers in the ascending order, showing the list obtained at each step:

                                  27, 15, 42, 3, 9, 29, 81, 54, 0, 13

Also calculate the total number of exchange operations and how many times the loop will execute in this algorithm.

28 May 2025
Answer :
Word Count : 571
To implement the Insertion Sort algorithm for sorting the list in ascending order, we start from the second element and compare it with elements before it. We shift elements greater than the key and insert the key at the correct position. Given list: `27, 15, 42, 3, 9, 29, 81, 54, 0, 13` ### Step-by-step Sorting: * Step 1 (i=1, key=15): Compare 15 with 27 → Shift 27 right Insert 15 `15, 27, 42, 3, 9, 29, 81, 54, 0, 13` * Step 2 (i=2, key=42): Compare with 27 → no shift `15, 27, 42, 3, 9, 29, 81, 54, 0, 13` * Step 3 (i=3, key=3): Compare with 42 → shift 42 Compare with 27 → shift 27 Compare with 15 → shift 15 Insert 3 `3, 15, 27, 42, 9, 29, 81, 54, 0, 13` * Step 4 (i=4, key=9): Compare with 42 → shift 42
________ _________ ________ ________ _______.
_________ ____ ______ ____ _____ _________ ________.
_________ __________ __________ ___ ___ _____ _____ _________ _________ ____ __________.
_____ _____ _____ ________ ______ _______.
____ _______ ______ ___ _______.
______ __________ __________ _______ ________ _____.
______ ______ _____ _______ _________ _____ ____ ______ ________ _________ _____ _________.
_________ ___ ________ ___ ___ ____ __________.
_______ _____ ___ ________ ___ ____ __________ ______.
______ ____ ___ ________ _____ ________ ___ ________ _____ _________ ___.
________ ___ _________ ___ _________ ___ ___ ________ _________ _____ __________.
_________ ____ ___ _________ __________ ____ __________.
_______ _______ _________ _________ ______ ___.
___ ____ ______ ____ _____.
______ _____ ____ _______ ________ _______ _________ _______ ____.
_______ ______ ________ ___ _______ _____ ________ ____ ___ _______ ______.
______ _____ ___ ____ _____ _____.
__________ _________ __________ _____ _____ _______ ______ _______ _______ __________ _______.
________ ________ _______ _____ ___ _________.
____ ____ ____ _____ ____ __________ ________.
_______ _______ ______ _____ ___ _______ _________ _________ ___.
_______ __________ ____ __________ _______ ____ _________ _____.
_________ ___ _________ _____ ___.
_______ ___ ____ ____ ______ ______ ___ __________ ____ ____ _______ ___.
_________ _______ ______ ________ _______ _________ ________ ___ ____ _______ _____.
___ ___ __________ ________ _________ ____.
______ _________ ________ _____ ____ ____ _______ _____.
______ _____ ________ _____ _________.
_______ __________ ________ ______ ____ _______ _________.
________ _______ ________ _______ ____ _______ ________ _____ ____ ___ ___.
_______ _______ _____ _______ __________ ___ _____ __________.
__________ _______ _______ ____ _____ ______ _______ _________ ___ _________ __________.
_______ ________ ____ _______ ____ ______ _________ ________.
_____ ________ _____ _______ ____ ______ ___.
_________ ________ _______ _______ ______ _________ _____ ________ __________ _______ __________ ________.
_________ _______ ____ _____ ________ ___ ______ _____ ________.
______ _________ _________ __________ _______ _______ ____ _______.
____ _______ _____ _________ ______ __________ __________ ________ ____ _____ ______.
___ _____ _________ ______ ______ _________ ____ __________ _______ ________.
______ _________ ____ ___ ___ ________ _________ __________ _______.
_____ ________ ____ _______ ___ _________ ____ _____ _________.
__________ ________ _____ _______ ___ _________ _______ ______ _____.
_______ _____ ________ ____ ____ ______ _____ _______ ________ _________.
___ _____ _________ ___ ________ ______ ________ ___.
______ ________ __________ ____ _______ ______.
________ ___ ______ _______ ___.
__________ ______ ______ ________ _______ ____ ______ _____ ___ __________ _______ _________.
_____ ___ ___ ______ __________ _______ _____.
_______ _______ _______ __________ ___ ________ ___ _______ _________ ______ ____ ____.
________ _______ ____ ____ _________ ___ _________ _______ __________ _____ ____ _______.
_______.
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 BCSL 45 2024 2025 - Implement the Insertion Sort algorithm for sorting the following list | IGNOU Academy
→
🟢
WhatsApp Chat Fast live messaging
→
Email Us Business enquiries & support
→