Adapt the bubble sort algorithm so that it stops when no interchanges are required. Express this more efficient version of the algorithm in pseudocode.

SolutionStep 1In this problem, we have to adapt that if interchange is not required then it stop. Write the algorithm of pseudo code in an efficient way of bubble sort.Bubble_sort(num1, num2, num3, ……….. Set of integers)Now, start the loopfor(index = 0 ; index < size ; index++) where index be the position in a list Assign the boolean value bool = false (Boolean variable is required if interchange is not required it stop) for(index_2 = 0 ; index_2 < size - index_1-1 ; index_2++) if(element at index position > element at index_2 position) then Bool = true (because the condition is true and interchange required) Assign the new temporary variable temp = element at index_2+1 position element at index_2 + 1 position = element at index_2 position element at index_2 position = temp End of if condition End of the index_2 loop if (not flag) (if no interchange require it stop) return End of the main loopBest case of complexity will be O(n).