function ac = ytb_conjugate ( n, a )

%*****************************************************************************80
%
%% ytb_conjugate() conjugates a Young tableau.
%
%  Discussion:
%
%    A Young tableau is also known as a Ferrers diagram.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    22 June 2024
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N, the integer that is partitioned.
%
%    integer A(N), describes the Young tableau.
%    A(I) is the row of the tableau on which I occurs.
%
%  Output:
%
%    integer AC(N), describes the conjugate Young tableau.
%
  ac = zeros(n,1);

  row = 0;

  while ( true )

    row = row + 1;

    col = 0;

    for j = 1 : n

      if ( a(j) == row )
        col = col + 1;
        ac(j) = col;
      end

    end

    if ( col == 0 )
      break;
    end

  end

  return
end
