Changing label name for algorithm

For the sake of consistency, define a new environment that uses the MegaAlgorithm caption style. Not sure whether you will intermix regular Algorithms and MegaAlgorithms, which this solution is geared towards:

enter image description here

\documentclass{article}
\usepackage[ruled,vlined]{algorithm2e}

\newenvironment{megaalgorithm}[1][htb]
  {\renewcommand{\algorithmcfname}{MegaAlgorithm}% Update algorithm name
   \begin{algorithm}[#1]%
  }{\end{algorithm}}

\begin{document}
\begin{megaalgorithm}
  \DontPrintSemicolon
  \KwData{$G=(X,U)$ such that $G^{tc}$ is an order.}
  \KwResult{$G’=(X,V)$ with $V\subseteq U$ such that $G’^{tc}$ is an interval order.}
  \caption{\textsc{Fast}SLAM}
\end{megaalgorithm}
\begin{algorithm}
  \DontPrintSemicolon
  \KwData{$G=(X,U)$ such that $G^{tc}$ is an order.}
  \KwResult{$G’=(X,V)$ with $V\subseteq U$ such that $G’^{tc}$ is an interval order.}
  \caption{\textsc{Fast}SLAM}
\end{algorithm}
\end{document}

The new megaalgorithm environment redefines \algorithmcfname - the macro used to print the caption type - just before calling the regular algorithm environment. Since the redefinition is within the scope of megaalgorithm, it is localized and reverts back to the default afterwards. This allows you to intermix the different kinds of algorithm types.


If you wish to have a separate counter for MegaAlgorithm and Algorithm, you can use the following definition of megaalgorithm in your preamble:

\makeatletter
\newcounter{megaalgorithm}
\newenvironment{megaalgorithm}[1][htb]
  {\renewcommand{\algorithmcfname}{MegaAlgorithm}% Update algorithm name
   \let\c@algocf\c@megaalgorithm% Update algorithm counter
   \begin{algorithm}[#1]%
  }{\end{algorithm}}
\makeatother

Its simpler:

With algorithm2e package, solution will be as follows: [ My working copy of algoithm2e.sty is here ]

\usepackage[ruled,vlined]{algorithm2e}
.
.

\begin{algorithm}
 \SetAlgorithmName{MegaAlgorithm}{} %last arg is the title of listing table
   ...
 \caption{How to write algorithm}
\end{algorithm}

Aside, since there is a considerable community using algorithmicx package (especially IEEE authors), here is the solution of the same problem with algorithmicx package:

\usepackage{algorithmicx}
\usepackage[Algorithm,ruled]{algorithm}
.
.

\begin{algorithm}
 \floatname{algorithm}{MegaAlgorithm}
  \begin{algorithmic}
    ...
  \end{algorithmic}
 \caption{How to write algorithm}
\end{algorithm}