2080 11

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...

Up nextDefine NP-complete problems with examples. Give brief proof of the statement "SAT is NP-co