\documentclass{article}
\input{generic-preamble/generic-preamble}
\usepackage{generic-preamble/tuple}
\usepackage{clrscode}

\begin{document}
\pagestyle{empty}
\begin{codebox}
  \Procname{\proc{Insert}(\textbf{keyword-set} S, \textbf{data} D)}
  \li \For \textbf{each} subset $s \subseteq S$ with $\abs{s} \le k$
  \li \Do
         $m \gets \tup<S, \proc{Hash}(D)>$
  \li    \Comment \textit{$m$ is the data's metadata block}
  \li    $I \gets \proc{Lookup}(\proc{Hash}(s))$
  \li    \Comment \textit{$I$ is the index node for $\proc{Hash}(s)$}
  \li    $I$.\proc{Put}($m$)
     \End
\end{codebox}
\vspace{.2in}
\begin{codebox}
  \Procname{\proc{Search} (\textbf{query} $Q$)}
  \li \Comment \textit{Executed on requesting node}
  \li $S \gets \proc{Keywords}(Q)$
  \li \For \textbf{some} $s \subseteq S$ \hspace{3em} ($\abs{s} \le
  k$) \>\>\>\>\>\>\>\>\>\>\>

  \li
         $I \gets \proc{Lookup}(\proc{Hash}(s))$ \>\>\>\>\>\>\>\>\>
  \li     \Comment \textit{$I$ is the index node for $s$}
  \li    \Return $I.\proc{Filtered-Get}($Q$)$
\end{codebox}
\vspace{.2in}
\begin{codebox}
  \Procname{\proc{Filtered-Get} (\textbf{query} $Q$)}
  \li \Comment \textit{Executed on index node}
  \li $R \gets \varnothing$
  \li \For \textbf{all} metadata blocks $m$ in the local index
  \li \Do
         \If $m$ \textbf{matches} $Q$
  \li    \Then
             $R \gets R \cup m$
      \End
  \End
  \li \Return $R$ 
\end{codebox}

\end{document}
