Skip to content

Commit 18d15f5

Browse files
ClémentClément
authored andcommitted
Editing makefile to make it ignore latex files.
1 parent 5bff8fe commit 18d15f5

File tree

2 files changed

+31
-10
lines changed

2 files changed

+31
-10
lines changed

source/Makefile

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -286,15 +286,15 @@ MAKEFLAGS:= -j
286286
# to be properly installed and set-up.
287287
# Cf. for example https://github.com/overleaf/toolkit/issues/298
288288

289-
$(IMG_DIR)%.pdf:$(IMG_DIR)%.tex
290-
latexmk -shell-escape -pdf -cd -quiet $<
291-
292-
$(IMG_DIR)%.svg:$(IMG_DIR)%.pdf
293-
pdf2svg $< $@
294-
295-
$(IMG_DIR)%.png:$(IMG_DIR)%.pdf
296-
pdftoppm $< $@ -png
297-
mv $@-1.png $@
289+
#$(IMG_DIR)%.pdf:$(IMG_DIR)%.tex
290+
# latexmk -shell-escape -pdf -cd -quiet $<
291+
#
292+
#$(IMG_DIR)%.svg:$(IMG_DIR)%.pdf
293+
# pdf2svg $< $@
294+
#
295+
#$(IMG_DIR)%.png:$(IMG_DIR)%.pdf
296+
# pdftoppm $< $@ -png
297+
# mv $@-1.png $@
298298

299299
# -------------------------------
300300
# "Prereq" rules.

source/docs/programming_and_computer_usage/complexity.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ The reason why worst case is generally preferred is because:
175175

176176
#### Linear search algorithm
177177

178-
The [linear search algorithm](https://princomp.github.io/lectures/data/search#finding-a-particular-value) look for a particular value in an array by inspecting the values one after the other:
178+
The [linear search algorithm](./lectures/data/search#finding-a-particular-value) looks for a particular value in an array by inspecting the values one after the other:
179179

180180
```{download="./code/projects/LinearSearch.zip"}
181181
!include`snippetStart="// Example value",snippetEnd="// We can optimize this algorithm"` code/projects/LinearSearch/LinearSearch/Program.cs
@@ -205,6 +205,27 @@ Similarly, considering that the array is of size $n$, and counting how many time
205205
Note that the space usage of both algorithms are $O(c)$, as they require only one variable if we do not copy the array.
206206
Note, also, that both algorithms have the same worst case and average case complexity, which are the cases we are actually interested in.
207207

208+
#### Binary search algorithm
209+
210+
The [binary search algorithm](./lectures/data/search#binary-search) looks for a particular value in a *sorted* array by leveraging this additional information: it "jumps" in the middle of the array, and if the value is found, it terminates, if the value is less than the target value, it keep looking in the right half of the array, and it keeps looking in the left half of the array otherwise.
211+
212+
What is the time complexity of such an algorithm? It halves the array at every step, and we know that if the array is of size $1$, then it will terminate (either because the value was found, or because it was not in the array).
213+
That means that, if the array is of size $n$, in the worst case,
214+
215+
- after $1$ step, we have an array of size $n / 2$ left to explore,
216+
- after $2$ steps, we have an array of size $n / 4$ left to explore,
217+
- after $3$ steps, we have an array of size $n / 8$ left to explore,
218+
- … after $k$ steps, we have an array of size $n / (2^k) left to explore.
219+
220+
Hence, we need to determine what is a $k$ such that $n / (2^k) \leqslant 1$ (since we terminate when the array is of size $1$)
221+
222+
223+
224+
225+
226+
227+
228+
208229
#### Matrix Multiplication
209230

210231
Consider the ["schoolbook algorithm for multiplication"](https://en.wikipedia.org/wiki/Computational_complexity_of_matrix_multiplication#Schoolbook_algorithm)

0 commit comments

Comments
 (0)