<prompt> Reverse engineer this algorithm.Input: An array A of N integers A1, A2, ..., ANOutput: A new sorted array B of N integers B1, B2, ..., BNFor i 2 to N j i while j 1 and Aj Aj-1 swap Aj and Aj-1 j j-1  <response>: This algorithm is an implementation of the Insertion Sort sorting algorithm. It sorts an input array A of N integers by iterating through each element from index i 2 to the end of the array N. For each element, the algorithm compares it to the one before it Aj to Aj-1 and if Aj is smaller than Aj-1, the two values are swapped. This process continues until either the beginning of the array is reached, or Aj is greater than or equal to Aj-1. Once the inner loop is finished for the current value of i, the array is guaranteed to be sorted up to index i. The end result is a sorted array from smallest to largest. 