notebook/contents/computer_science.tex

68 lines
1.4 KiB
TeX

\langchapter{Science informatique}{Computer Science}
%TODO Complete chapter
\langsection{Algorithmes}{Algorithms}
%TODO Complete section
\index{Algorithms}
\begin{algorithm}[H]
\KwIn{This is some input}
\KwOut{This is some output}
\SetAlgoLined
\SetNoFillComment
\tcc{This is a comment}
some code here\;
$x \leftarrow 0$\;
$y \leftarrow 0$\;
\uIf{$ x > 5$} {
x is greater than 5 \tcp*{This is also a comment}
}
\Else {
x is less than or equal to 5\;
}
\ForEach{y in 0..5} {
$y \leftarrow y + 1$\;
}
\For{$y$ in $0..5$} {
$y \leftarrow y - 1$\;
}
\While{$x > 5$} {
$x \leftarrow x - 1$\;
}
\Return Return something here\;
\caption{what}
\end{algorithm}
\langsection{Exemple en Haskell}{Haskell example}
\begin{lstlisting}[language=Haskell]
fibonacci :: Int -> Int
fibonacci 0 = 0
fibonacci 1 = 1
fibonacci n = fibonacci (n - 1) + fibonacci (n - 2)
\end{lstlisting}
\langsection{Exemple en Python}{Python example}
\begin{lstlisting}[language=Python]
def fibonacci(n: int) -> int:
if n == 0 or n == 1:
return n
return fibonacci(n - 1) + fibonacci(n - 2)
\end{lstlisting}
\langsection{Exemple en C}{C example}
\begin{lstlisting}[language=C]
int fibonacci(const int n){
if (n == 0 || n == 1)
return n;
return fibonacci(n - 1) + fibonacci(n - 2);
}
\end{lstlisting}
\langsection{Intelligence artificiel}{Artificial Intelligence}
%TODO Complete section
\langsubsection{Thèse orthogonal (et stupidité)}{Orthogonal Thesis (and stupidity)}
% TODO Complete subsection