Find all missing numbers from a given sorted array | Function to find the missing elements ; Initialize diff ; Check if diff and arr [ i ] - i both are equal or not ; Loop for consecutive missing elements ; Given array arr [ ] ; Function call
def printMissingElements ( arr , N ) : NEW_LINE INDENT diff = arr [ 0 ] NEW_LINE for i in range ( N ) : NEW_LINE INDENT if ( arr [ i ] - i != diff ) : NEW_LINE INDENT while ( diff < arr [ i ] - i ) : NEW_LINE INDENT print ( i + diff , end = " ▁ " ) NEW_LINE diff += 1 NEW_LINE DEDENT DEDENT DEDENT DEDENT arr = [ 6 , 7 , 10 , 11 , 13 ] NEW_LINE N = len ( arr ) NEW_LINE printMissingElements ( arr , N ) NEW_LINE