static void indexedSequentialSearch ( int arr [ ] , int n , int k ) {
  int elements [ ] = new int [ 20 ] ;
  int indices [ ] = new int [ 20 ] ;
  int temp , i ;
  int j = 0 , ind = 0 , start = 0 , end = 0 ;
  for ( i = 0 ;
  i < n ;
  i += 3 ) {
    elements [ ind ] = arr [ i ] ;
    indices [ ind ] = i ;
    ind ++ ;
  }
  if ( k < elements [ 0 ] ) {
    System . out . println ( "Not found" ) ;
    return ;
  }
  else {
    for ( i = 1 ;
    i <= ind ;
    i ++ ) if ( k < elements [ i ] ) {
      start = indices [ i - 1 ] ;
      end = indices [ i ] ;
      break ;
    }
  }
  for ( i = start ;
  i <= end ;
  i ++ ) {
    if ( k == arr [ i ] ) {
      j = 1 ;
      break ;
    }
  }
  if ( j == 1 ) System . out . println ( "Found at index " + i ) ;
  else System . out . println ( "Not found" ) ;
}

static void indexedSequentialSearch ( int arr [ ] , int n , int k ) { int elements [ ] = new int [ 20 ] ; int indices [ ] = new int [ 20 ] ; int temp , i ; int j = 0 , ind = 0 , start = 0 , end = 0 ; for ( i = 0 ; i < n ; i += 3 ) { elements [ ind ] = arr [ i ] ; indices [ ind ] = i ; ind ++ ; } if ( k < elements [ 0 ] ) { System . out . println ( " Not ▁ found " ) ; return ; } else { for ( i = 1 ; i <= ind ; i ++ ) if ( k < elements [ i ] ) { start = indices [ i - 1 ] ; end = indices [ i ] ; break ; } } for ( i = start ; i <= end ; i ++ ) { if ( k == arr [ i ] ) { j = 1 ; break ; } } if ( j == 1 ) System . out . println ( " Found ▁ at ▁ index ▁ " + i ) ; else System . out . println ( " Not ▁ found " ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier) dimensions: (dimensions)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (decimal_integer_literal))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (decimal_integer_literal))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier)) declarator: (variable_declarator name: (identifier))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (assignment_expression left: (identifier) right: (decimal_integer_literal)) condition: (binary_expression left: (identifier) right: (identifier)) update: (assignment_expression left: (identifier) right: (decimal_integer_literal)) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))) (expression_statement (update_expression (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (array_access array: (identifier) index: (decimal_integer_literal)))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) (return_statement)) alternative: (block (for_statement init: (assignment_expression left: (identifier) right: (decimal_integer_literal)) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier)))) consequence: (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: (identifier) right: (array_access array: (identifier) index: (identifier)))) (break_statement)))))) (for_statement init: (assignment_expression left: (identifier) right: (identifier)) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (break_statement))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (string_literal) right: (identifier))))) alternative: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))))))