Question
Analyze best case, average case, and worst-case time complexities of following algorithms with the help of suitable examples.
(i) Insertion sort
(ii) Quick sort
(iii) Binary search
(iv) Selection sort
Answer :
Word Count : 344
____ __________ ____ _____ _________ __________ _____ ______ _____ ________.
_____ ______ __________ _________ ______ _____ _________.
_____ __________ _____ ______ _____.
______ ______ ___ __________ ______ __________.
______ ____ ________ ____ ________ _____ ____ ____ _______.
_________ ______ _______ _________ __________ ______ ______ _________ ___ _____.
______ ____ ______ _______ ___ _______.
__________ _____ _______ __________ __________ _____.
__________ ___ _______ ______ _________.
_______ ________ ___ ___ ____ _______.
________ _______ _________ __________ _________ ______ _____ ________.
______ _________ ________ ________ _____ ________ _____ _____ __________.
________ _____ ______ ____ _____ _____ ___ ________ __________ ___ _______.
__________ __________ ________ ________ _________ ____ ___ ___ ________ ______ _______.
__________ _______ ___ ______ _________ ______.
____ ____ __________ _________ ___ _________ _______ ____ __________ ____ ______.
____ __________ _______ __________ __________ _________ _____ ________ ____ ______.
_________ ________ ______ _______ ______ ________ __________ ________.
___ __________ __________ ________ ___ _____.
_____ __________ __________ _________ _____ _______ ___ __________ _________ _________ ________ _____.
_________ _________ _____ ___ __________ ________.
_______ ___ ______ ________ _______ _________ ____.
____ _____ _____ _____ _______ ______ _________ ________ _________ __________ _______ _____.
_______ __________ ________ __________ _________ _________ __________ ________ _______ _____ ____.
_____ _______ ______ ____ ________.
_________ _____ __________ _______ ______ _____ ___ _________ _____ _________.
_________ ______ ______ _________ __________ _____.
Skip in 10
(i) Insertion Sort Best Case: When the array is already sorted, each element is compared once. * Time complexity: O(n) * Example: \[1, 2, 3, 4, 5] Average Case: Each element may be compared with half of the sorted subarray. * Time complexity: O(n²) * Example: \[4, 3, 1, 5, 2] Worst Case: When the array is sorted in reverse order, each element is compared with all previous elements. * Time complexity: O(n²) * Example: \[5, 4, 3, 2, 1] --- (ii) Quick Sort Best Case: The pivot divides the array into two equal halves at every recursion level. * Time complexity: O(n log n) * Example: Balanced partitioning like \[4, 2, 1, 3,
________ ________ ____ ____ _________ _______ ___ ____ _____ ___ _______.____ __________ ____ _____ _________ __________ _____ ______ _____ ________.
_____ ______ __________ _________ ______ _____ _________.
_____ __________ _____ ______ _____.
______ ______ ___ __________ ______ __________.
______ ____ ________ ____ ________ _____ ____ ____ _______.
_________ ______ _______ _________ __________ ______ ______ _________ ___ _____.
______ ____ ______ _______ ___ _______.
__________ _____ _______ __________ __________ _____.
__________ ___ _______ ______ _________.
_______ ________ ___ ___ ____ _______.
________ _______ _________ __________ _________ ______ _____ ________.
______ _________ ________ ________ _____ ________ _____ _____ __________.
________ _____ ______ ____ _____ _____ ___ ________ __________ ___ _______.
__________ __________ ________ ________ _________ ____ ___ ___ ________ ______ _______.
__________ _______ ___ ______ _________ ______.
____ ____ __________ _________ ___ _________ _______ ____ __________ ____ ______.
____ __________ _______ __________ __________ _________ _____ ________ ____ ______.
_________ ________ ______ _______ ______ ________ __________ ________.
___ __________ __________ ________ ___ _____.
_____ __________ __________ _________ _____ _______ ___ __________ _________ _________ ________ _____.
_________ _________ _____ ___ __________ ________.
_______ ___ ______ ________ _______ _________ ____.
____ _____ _____ _____ _______ ______ _________ ________ _________ __________ _______ _____.
_______ __________ ________ __________ _________ _________ __________ ________ _______ _____ ____.
_____ _______ ______ ____ ________.
_________ _____ __________ _______ ______ _____ ___ _________ _____ _________.
_________ ______ ______ _________ __________ _____.
IGNOU ACADEMY
Your IGNOU journey, made easier.
- Solved Assignments
- Study Notes
- Guess Papers
- Question Papers
Continue Reading — It's Free
Sign in with Google to unlock more of this answer.
✓ Free access
✓ Unlock up to 60% of the answer
✓ No payment required
✓ Unlock up to 60% of the answer
✓ No payment required
Quick Google sign-in. No separate registration form.