I have a big problem with referencing my tables. Below is how I do it. The pdf seems to know which table I refer to (the reference links me to the right table), but instead of a number it writes "??".
Table \ref{medaltable} summarizes the results
\begin{table}
\label{medaltable}
\caption{The summary of the performance of the algorithms in terms of the number of nodes activated during the information diffusion}
\center
\begin{tabular}{ | l | c | c | c | c | }
\toprule
\textit{algorithm} & \textit{first} & \textit{second} & \textit{third} & \textit{total} \\ \hline
GR & 4 & 4 & 2 & 22 \\
SHALG & 4 & 3 & 4 & 22 \\
CUST2 & 4 & 4 & 1 & 21 \\
\bottomrule
\end{tabular}
\end{table}

\labelinto the.auxfile in the first pass, and reads it back in (and outputs it) in the second pass. also,\labelmust be input after\caption, since it picks up the value of the last referenceable object, and that (for a table or figure) is the\caption. so in this example, the cross-reference won't be the table, but whatever might have been numbered previously, like a\section. – barbara beeton Sep 05 '13 at 18:18\labelcommand must go after the\caption. Don't use\center, but rather\centering. And don't add vertical rules in tables, if you're going to use\topruleand friends; better yet, never use vertical rules in tables. – egreg Sep 05 '13 at 19:31