Skip to content

Commit 55c9d06

Browse files
authored
Merge pull request #37 from lamafab/lamafab-algos-data-ii
Cheatsheets for CM2035 Algorithms & Data Structures II
2 parents ea76782 + f2dcb6f commit 55c9d06

16 files changed

+1113
-0
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# About
2+
3+
Listed here is a collection of cheatsheet by topic. Those cheatsheets do not
4+
explain the topics in depth, but rather serve as quick lookup documents.
5+
Therefore, the course material provided by the lecturer should still be studied
6+
and understood. Not everything that is tested at the mid-terms or final exams is
7+
covered and the Author does not guarantee that the cheatsheets are free of
8+
errors.
9+
10+
* [Time and Space Complexity](./cheatsheet_time_space_complexity.pdf)
11+
* [Asymptotic Analysis](./cheatsheet_asymptotic_analysis.pdf)
12+
* [Time Complexity of Recursive Algorithms](.cheatsheet_time_complexity_recursive_algorithms.pdf)
13+
* [Comparison and Non-Comparison Sorting Algorithms](./cheatsheet_sorting_algorithms.pdf)
14+
* [Hash Tables](./cheatsheet_hash_tables.pdf)
15+
16+
**NOTE**: Those cheatsheets only cover the course material **up to the midterms**.
17+
The weeks after the midterms are not covered here.
18+
19+
# Building
20+
21+
_NOTE_: This step is only necessary if you chose to modify the base documents.
22+
23+
The base documents are written in [AsciiDoc](https://asciidoc.org/) and can be
24+
found in the `src/` directory.
25+
26+
The following dependencies must be installed (Ubuntu):
27+
28+
```console
29+
$ apt install -y ruby-dev wkhtmltopdf
30+
$ gem install asciidoctor
31+
$ chmod +x build.sh
32+
```
33+
34+
To build the documents (PDF version):
35+
36+
```console
37+
$ ./build.sh pdf
38+
```
39+
40+
Optionally, for the HTML version:
41+
42+
```console
43+
$ ./build.sh html
44+
```
45+
46+
and for the PNG version:
47+
48+
```console
49+
$ ./build.sh png
50+
```
51+
52+
The generated output can be deleted with `./build.sh clean`.
53+
54+
# Disclaimer
55+
56+
The Presented Documents ("cheatsheets") by the Author ("Fabio Lama") are
57+
summaries of specific topics. The term "cheatsheet" implies that the Presented
58+
Documents are intended to be used as learning aids or as references for
59+
practicing and does not imply that the Presented Documents should be used for
60+
inappropriate practices during exams such as cheating or other offenses.
61+
62+
The Presented Documents are heavily based on the learning material provided by
63+
the University of London, respectively the VLeBooks Collection database in the
64+
Online Library and the material provided on the Coursera platform.
65+
66+
The Presented Documents may incorporate direct or indirect definitions,
67+
examples, descriptions, graphs, sentences and/or other content used in those
68+
provided materials. **At no point does the Author present the work or ideas
69+
incorporated in the Presented Documents as their own.**
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#!/bin/bash
2+
3+
# Because `make` sucks.
4+
5+
gen_html() {
6+
# Remove suffix and prefix
7+
FILE=$1
8+
OUT=${FILE%.adoc}
9+
HTML_OUT="cheatsheet_${OUT}.html"
10+
11+
asciidoctor $FILE -o ${HTML_OUT}
12+
}
13+
14+
# Change directory to src/ in order to have images included correctly.
15+
cd "$(dirname "$0")/src/"
16+
17+
case $1 in
18+
html)
19+
for FILE in *.adoc
20+
do
21+
# Generate HTML file.
22+
gen_html ${FILE}
23+
done
24+
25+
# Move up from src/
26+
mv *.html ../
27+
;;
28+
pdf)
29+
for FILE in *.adoc
30+
do
31+
# Generate HTML file.
32+
gen_html ${FILE}
33+
34+
# Convert HTML to PDF.
35+
PDF_OUT="cheatsheet_${OUT}.pdf"
36+
wkhtmltopdf \
37+
--enable-local-file-access \
38+
--javascript-delay 2000\
39+
$HTML_OUT $PDF_OUT
40+
done
41+
42+
# Move up from src/
43+
mv *.pdf ../
44+
45+
# Cleanup temporarily generated HTML files.
46+
rm *.html > /dev/null 2>&1
47+
;;
48+
png | img)
49+
for FILE in *.adoc
50+
do
51+
# Generate HTML file.
52+
gen_html ${FILE}
53+
54+
# Convert HTML to PNG.
55+
IMG_OUT="cheatsheet_${OUT}.png"
56+
wkhtmltopdf \
57+
--enable-local-file-access \
58+
--javascript-delay 2000\
59+
$HTML_OUT $IMG_OUT
60+
done
61+
62+
# Move up from src/
63+
mv *.png ../
64+
65+
# Cleanup temporarily generated HTML files.
66+
rm *.html > /dev/null 2>&1
67+
;;
68+
clean)
69+
rm *.html > /dev/null 2>&1
70+
rm *.png > /dev/null 2>&1
71+
rm ../*.html > /dev/null 2>&1
72+
rm ../*.png > /dev/null 2>&1
73+
;;
74+
*)
75+
echo "Unrecognized command"
76+
;;
77+
esac
962 KB
Binary file not shown.
964 KB
Binary file not shown.
1.7 MB
Binary file not shown.
1.13 MB
Binary file not shown.
2.47 MB
Binary file not shown.
21.2 KB
Loading
179 KB
Loading
26.2 KB
Loading

0 commit comments

Comments
 (0)