mirror of
https://github.com/janishutz/eth-summaries.git
synced 2025-11-25 10:34:23 +00:00
Add A&W summary. Still WIP for fixing errors and more proofs
This commit is contained in:
10
semester2/algorithms-and-probability/parts/coding.tex
Normal file
10
semester2/algorithms-and-probability/parts/coding.tex
Normal file
@@ -0,0 +1,10 @@
|
||||
\newsection
|
||||
\section{Coding}
|
||||
\label{sec:implementation}
|
||||
\subsection{Tricks}
|
||||
\begin{itemize}
|
||||
\item Encoding subsets is very easy using bitshift operators. We can use \verb|(i & (1 << j)) != 0| in combination with a loop to go through all subsets of the set. The for-loop will have to go from $i = 1$ (if we want to exclude the empty set) to $i = 2^k - 1$
|
||||
\item Inclusion-Excluison is very powerful
|
||||
\item Always check the what the input values are and expect them to provide bad code (e.g. provided code reads ints, even though we need to read doubles (or long)). An easy way to check if everything is correct, is to print the data import's results and compare with the input files if something looks incorrect
|
||||
\item DP (as always) can come in very handy for solving probabilities related problems
|
||||
\end{itemize}
|
||||
Reference in New Issue
Block a user