# Aligning algorithms using array

Why not all algorithms are getting printed (only 5 out of 7 are displayed) ? What is wrong in this code?

I tried using array to align it better, but it is not working. Can somebody suggest how to align these algorithms properly using array environment.

\documentclass[runningheads]{llncs}
\usepackage{graphicx}
\usepackage{epsfig}
\usepackage{subcaption}
\usepackage{calc}
\usepackage{amssymb}
\usepackage{amstext}
\usepackage{amsmath}
\let\proof\relax
\let\endproof\relax
\usepackage{amsthm}
\usepackage{multicol}
\usepackage{pslatex}
%\usepackage{apalike}
\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{algorithmic}
\usepackage{graphicx}
\usepackage{textcomp}
\usepackage{xcolor}
\usepackage{mathtools}
\usepackage{graphicx}
\usepackage{textcomp}
\usepackage{xcolor}
\usepackage{tikz}
\usepackage[underline=true]{pgf-umlsd}
\usepackage{flexisym}
\usepackage{siunitx}
\usepackage{float}
\usepackage{supertabular,booktabs}
\usepackage{enumitem,kantlipsum}
\usepackage{tcolorbox}
\usepackage{longtable}
\usepackage{tikz-qtree}
\usetikzlibrary{positioning, shapes.geometric}
\usepackage{arydshln}
\usepackage{upgreek}
\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage{float}
\usepackage{url}

\DeclareMathSymbol{\al}  {\mathord}{letters}{"0B}
\DeclareMathSymbol{\be}   {\mathord}{letters}{"0C}
\DeclareMathSymbol{\ga}  {\mathord}{letters}{"0D}
\DeclareMathSymbol{\de}  {\mathord}{letters}{"0E}
\DeclareMathSymbol{\ep}{\mathord}{letters}{"0F}
\DeclareMathSymbol{\ze}   {\mathord}{letters}{"10}
\DeclareMathSymbol{\et}    {\mathord}{letters}{"11}
\DeclareMathSymbol{\thet}  {\mathord}{letters}{"12}
\DeclareMathSymbol{\io}   {\mathord}{letters}{"13}
\DeclareMathSymbol{\ka}  {\mathord}{letters}{"14}
\DeclareMathSymbol{\la} {\mathord}{letters}{"15}
\DeclareMathSymbol{\m}     {\mathord}{letters}{"16}
\DeclareMathSymbol{\n}     {\mathord}{letters}{"17}
\DeclareMathSymbol{\x}     {\mathord}{letters}{"18}
\DeclareMathSymbol{\p}     {\mathord}{letters}{"19}
\DeclareMathSymbol{\rh}    {\mathord}{letters}{"1A}
\DeclareMathSymbol{\sig}  {\mathord}{letters}{"1B}
\DeclareMathSymbol{\ta}    {\mathord}{letters}{"1C}
\DeclareMathSymbol{\up}{\mathord}{letters}{"1D}
\DeclareMathSymbol{\ph}    {\mathord}{letters}{"1E}
\DeclareMathSymbol{\ch}    {\mathord}{letters}{"1F}
\DeclareMathSymbol{\ps}    {\mathord}{letters}{"20}
\DeclareMathSymbol{\om}  {\mathord}{letters}{"21}
\DeclareMathSymbol{\va}{\mathord}{letters}{"22}
\DeclareMathSymbol{\va}{\mathord}{letters}{"23}
\DeclareMathSymbol{\va}  {\mathord}{letters}{"24}
\DeclareMathSymbol{\va} {\mathord}{letters}{"27}

\newcommand {\enc}[2]{\{ #1 \}_{#2} }
%\newcommand {\mess1}[4] {#1 \rightarrow #2 : {\enc {#3} {#4}}}
\newcommand {\believes}[2] {#1 \mid\!\equiv #2}
\newcommand {\oncesaid}[2] {#1 \mid\!\sim #2}
\newcommand {\isgoodkey}[3] { #1 \stackrel{#3}{\longleftrightarrow}  #2 }
\newcommand {\fresh}[1] {\sharp( #1 )}
\newcommand{\jurisdiction}[2] {#1  \models\!>   #2}
\newcommand{\sees}{\triangleleft}
\newcommand{\sendsto}[2]{#1\rightarrow#2}
\newcommand{\possess}{\!\!\ni\!\!}
\newcommand{\utter}{|\!\!\sim\!\!}
\newcommand{\pubkey}[2]{\stackrel{{\textstyle#1}}{\mapsto}#2}
\newcommand{\sharesec}[3]{#2\stackrel{{\textstyle#1}}{\rightleftharpoons}#3}

\begin{document}

\begin{multicols}{2}
{
\begin{algorithm}[H]
\caption{$\mathrm{AA:PullKey}$}\label{alg:pullkey}
\begin{algorithmic}
\REQUIRE $\mathrm{\langle{IDT_{ij}, K}\rangle}$
\STATE $\mathrm{r \in_R \mathbb{Z}_p}$
\STATE $\mathrm{\langle{D_1, D_2}\rangle \leftarrow genParitalKey(IDT_{ij}, K, \alpha)}$
\STATE $\mathrm{\quad D_1 = K^{q_x(0)/t_i} \quad \forall i \in L(IDT_{ij}\rightarrow T)}$
\STATE $\mathrm{\quad D_2 = K^\alpha}$
\STATE $\mathrm{return\ \langle{D_1, D_2}\rangle}$
\end{algorithmic}
\end{algorithm}
}
{
\begin{algorithm}[H]
\caption{$\mathrm{UIDAI:PullKeyAll}$}\label{alg:pullkeyall}
\begin{algorithmic}
\REQUIRE $\mathrm{\langle{IDT_{ij}, K}\rangle}$
\STATE $\mathrm{D_1 = D_2 =} \phi$
\STATE $\mathrm{AA \leftarrow GetAA(IDT_{ij}\rightarrow T)}$
\WHILE {$\mathrm{AA \neq empty}$}
\STATE $\mathrm{AA_i \leftarrow DEQUEUE(AA)}$
\STATE $\mathrm{Call\ AA_i\ API:\ \langle{D_1\prime, D_2\prime}\rangle \leftarrow PullKey(IDT_{ij}, K)}$
\STATE $\mathrm{D_1 = D \cup D_1\prime}$
\STATE $\mathrm{D_2 = D, D_2\prime}$
\ENDWHILE
\STATE $\mathrm{return\ \langle{D_1, D_2}\rangle}$
\end{algorithmic}
\end{algorithm}
}
{
\begin{algorithm}[H]
\caption{$\mathrm{AA:PullK}$}\label{alg:pullk}
\begin{algorithmic}
\REQUIRE $\mathrm{\langle{IDT_{ij}, K}\rangle}$
\STATE $\mathrm{r \in_R \mathbb{Z}_p}$
\STATE $\mathrm{Store\ mapping:\ IDT_{ij} \leftrightarrow r}$
\STATE $\mathrm{return\ K^r}$
\end{algorithmic}
\end{algorithm}
}
{
\begin{algorithm}[H]
\caption{$\mathrm{AA:PushK}$}\label{alg:pushk}
\begin{algorithmic}
\REQUIRE $\mathrm{\langle{IDT_{ij}, K}\rangle}$
\STATE $\mathrm{r \in_R \mathbb{Z}_p}$
\STATE $\mathrm{Update\ mapping:\ IDT_{ij} \leftrightarrow K}$
\STATE $\mathrm{return}$
\end{algorithmic}
\end{algorithm}
}
{
\begin{algorithm}[H]
\caption{$\mathrm{UIDAI:GenTokPullAllK}$}\label{alg:gentokpullallk}
\begin{algorithmic}
\REQUIRE $\mathrm{\langle{IDT_{ij}, K}\rangle}$
\STATE $\mathrm{AA \leftarrow GetAA(IDT_{ij}\rightarrow T)}$
\WHILE {$\mathrm{AA \neq empty}$}
\STATE $\mathrm{AA_i \leftarrow DEQUEUE(AA)}$
\STATE $\mathrm{Call\ AA_i\ API:\ K \leftarrow PullK(IDT_{ij}, K)}$
\ENDWHILE
\STATE $\mathrm{AA \leftarrow GetAA(IDT_{ij}\rightarrow T)}$
\WHILE {$\mathrm{AA \neq empty}$}
\STATE $\mathrm{AA_i \leftarrow DEQUEUE(AA)}$
\STATE $\mathrm{Call\ AA_i\ API:\ PushK(IDT_{ij}, K)}$
\ENDWHILE
\STATE $\mathrm{return\ K}$
\end{algorithmic}
\end{algorithm}
}
{
\begin{algorithm}
\caption{$\mathrm{ESP:GenTok}$}\label{alg:gentok1}
\begin{algorithmic}
\REQUIRE $\mathrm{\langle{IDT_{ij}, K}\rangle}$
\STATE $\mathrm{r \in_R \mathbb{Z}_p}$
\STATE $\mathrm{K \leftarrow K^r}$
\STATE $\mathrm{K \leftarrow UIDAI:GenTokPullAllK(IDT_{ij}, K)}$
\STATE $\mathrm{Store\ mapping:\ IDT_{ij} \leftrightarrow K}$
\STATE $\mathrm{\langle{D_1, D_2}\rangle \leftarrow UIDAI:PullKeyAll(IDT_{ij}, K)}$
\STATE $\mathrm{IDT_{ij} = }$
\STATE $\mathrm{\quad ID_{ij}: ID_i, \mathcal{T}_j}$
\STATE $\mathrm{\quad D_1 : D_U \cup D_{AA_1} \cup D_{AA_2} \cup ...}$
\STATE $\mathrm{\quad D_2 :} \mathrm{K}^\al, \mathrm{K}^\be, \mathrm{K}^\ga, ...$
\STATE $\mathrm{return}$
\end{algorithmic}
\end{algorithm}
}
{
\begin{algorithm}
\caption{$\mathrm{Subscriber:genTok}$}\label{alg:gentok2}
\begin{algorithmic}
\REQUIRE $\mathrm{\langle{IDT_{ij}}\rangle}$
\STATE $\mathrm{r \in_R \mathbb{Z}_p}$
\STATE $\mathrm{K \leftarrow g^r}$
\STATE $\mathrm{K \leftarrow ESP:GenTok(IDT_{ij}, K, \mathcal{T})}$
\STATE $\mathrm{Store\ mapping:\ IDT_{ij} \leftrightarrow K}$
\STATE $\mathrm{return}$
\end{algorithmic}
\end{algorithm}
}
{
}
\end{multicols}

\end{document}


• You are using llncs.cls, is it common? Feb 14 '20 at 9:45
• You are forgetting the [H] in the last two algorithm environments. Mar 15 '20 at 10:18

Please remove the \begin{multicols}...\end{multicols} then check. If you really need twocolumn text, then try with \documentclass[twocolumn]...
You are forgetting [H] in the last two algorithm environments.
You cannot have floats inside multicols.