static int findMissingNo ( int [ ] arr , int n ) {
  int val ;
  int nextval ;
  for ( int i = 0 ;
  i < n ;
  i ++ ) {
    if ( arr [ i ] <= 0 || arr [ i ] > n ) continue ;
    val = arr [ i ] ;
    while ( arr [ val - 1 ] != val ) {
      nextval = arr [ val - 1 ] ;
      arr [ val - 1 ] = val ;
      val = nextval ;
      if ( val <= 0 || val > n ) break ;
    }
  }
  for ( int i = 0 ;
  i < n ;
  i ++ ) {
    if ( arr [ i ] != i + 1 ) {
      return i + 1 ;
    }
  }
  return n + 1 ;
}

static int findMissingNo ( int [ ] arr , int n ) { int val ; int nextval ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] <= 0 || arr [ i ] > n ) continue ; val = arr [ i ] ; while ( arr [ val - 1 ] != val ) { nextval = arr [ val - 1 ] ; arr [ val - 1 ] = val ; val = nextval ; if ( val <= 0 || val > n ) break ; } } for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] != i + 1 ) { return i + 1 ; } } return n + 1 ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal)) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier)))) consequence: (continue_statement)) (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier)))) (while_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (identifier))) body: (block (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (identifier)))) consequence: (break_statement)))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (block (return_statement (binary_expression left: (identifier) right: (decimal_integer_literal))))))) (return_statement (binary_expression left: (identifier) right: (decimal_integer_literal)))))