Design and Analysis of Algorithms20805 marksSorting Algorithms
Write down algorithm of insertion sort and analyze its time and space complexity.
Write down algorithm of insertion sort and analyze its time and space complexity. [5]
Insertion Sort works by picking each element and inserting it into its correct position among the already-sorted elements to its left. Steps: 1. Start with the array A of n elements. 2. Pick the element at position i (starting from i = 1). 3. Store it in a temporary variable temp = A[i]. 4. Compa...