static int LongestIncreasingSubsequenceLength ( int A [ ] , int size ) {
  int [ ] tailTable = new int [ size ] ;
  int len ;
  tailTable [ 0 ] = A [ 0 ] ;
  len = 1 ;
  for ( int i = 1 ;
  i < size ;
  i ++ ) {
    if ( A [ i ] < tailTable [ 0 ] ) tailTable [ 0 ] = A [ i ] ;
    else if ( A [ i ] > tailTable [ len - 1 ] ) tailTable [ len ++ ] = A [ i ] ;
    else tailTable [ CeilIndex ( tailTable , - 1 , len - 1 , A [ i ] ) ] = A [ i ] ;
  }
  return len ;
}

static int LongestIncreasingSubsequenceLength ( int A [ ] , int size ) { int [ ] tailTable = new int [ size ] ; int len ; tailTable [ 0 ] = A [ 0 ] ; len = 1 ; for ( int i = 1 ; i < size ; i ++ ) { if ( A [ i ] < tailTable [ 0 ] ) tailTable [ 0 ] = A [ i ] ; else if ( A [ i ] > tailTable [ len - 1 ] ) tailTable [ len ++ ] = A [ i ] ; else tailTable [ CeilIndex ( tailTable , - 1 , len - 1 , A [ i ] ) ] = A [ i ] ; } return len ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier) dimensions: (dimensions)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (array_access array: (identifier) index: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (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: (array_access array: (identifier) index: (decimal_integer_literal)))) consequence: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (array_access array: (identifier) index: (identifier)))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))) consequence: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (update_expression (identifier))) right: (array_access array: (identifier) index: (identifier)))) alternative: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (method_invocation name: (identifier) arguments: (argument_list (identifier) (unary_expression operand: (decimal_integer_literal)) (binary_expression left: (identifier) right: (decimal_integer_literal)) (array_access array: (identifier) index: (identifier))))) right: (array_access array: (identifier) index: (identifier)))))))) (return_statement (identifier))))