{// Reverse the sub-arraywhile(left < right) {inttemp = data[left]; data[left++] = data[right]; data[right--] = temp; }// Return the updated arrayreturndata; }// Function to find the next permutation// of the g