Просмотр исходного кода

Markdownify all markdown files

Michael Mächtel 8 лет назад
Родитель
Сommit
23bf98a70b
4 измененных файлов: 87 добавлений и 60 удалений
  1. 10
    8
      hw2/README.md
  2. 52
    23
      hw2/simu1/QUESTIONS.md
  3. 19
    22
      hw2/task1/README.md
  4. 6
    7
      hw2/task3/README.md

+ 10
- 8
hw2/README.md Просмотреть файл

@@ -1,6 +1,7 @@
1 1
 # hw2
2 2
 
3 3
 ## Tasks
4
+
4 5
 To fullfill **hw2** you have to solve:
5 6
 
6 7
 - task1
@@ -13,20 +14,21 @@ Optional are (bonus +1P):
13 14
 
14 15
 ## Files
15 16
 
16
-You find already files for earch rust task. Please remember to use cargo to create the relevant projects for each task.
17
-
17
+You find already files for each rust task. Please remember to use cargo to
18
+create the relevant projects for each task.
18 19
 
19 20
 ## ASIDE: `simu1/` dir
20 21
 
21
-In this homework it's not a simulation homework sitting in `simu1/` but some questions to have fun with buggy c-files. As not to interfer with rust code, questions, c-code and your answers should go into `simu1/`.
22
-
23
-## Pull-Reuest
22
+In this homework it's not a simulation homework sitting in `simu1/` but some
23
+questions to have fun with buggy c-files. As not to interfer with rust code,
24
+questions, c-code and your answers should go into `simu1/`.
24 25
 
25
-Please merge any accepted reviews into your branch. If you are ready with the homework, all tests run, please create a pull request named **hw2**.
26
+## Pull-Request
26 27
 
27
-## Gradings
28
+Please merge any accepted reviews into your branch. If you are ready with the
29
+homework, all tests run, please create a pull request named **hw2**.
28 30
 
29
-### hw2
31
+## Gradings of hw2
30 32
 
31 33
 | Task     | max. Credits | Comment |
32 34
 | -------- | ------------ | ------- |

+ 52
- 23
hw2/simu1/QUESTIONS.md Просмотреть файл

@@ -2,42 +2,71 @@
2 2
 
3 3
 ## Overview
4 4
 
5
-In this task, you will gain some familiarity with memory allocation. First, you’ll write some buggy programs (fun!). Then, you’ll use some tools to help you find the bugs you inserted. Then, you will realize how awesome these tools are and use them in the future, thus making yourself more happy and productive.
5
+In this task, you will gain some familiarity with memory allocation. First,
6
+you’ll write some buggy programs (fun!). Then, you’ll use some tools to help you
7
+find the bugs you inserted. Then, you will realize how awesome these tools are
8
+and use them in the future, thus making yourself more happy and productive.
6 9
 
7
-The first tool you’ll use is **gdb**, the debugger. There is a lot to learn about this debugger; here we’ll only scratch the surface. Here you can find a [quick reference gdb][]. Also **ddd** is installed on lab workstations.
10
+The first tool you’ll use is **gdb**, the debugger. There is a lot to learn
11
+about this debugger; here we’ll only scratch the surface. Here you can find a
12
+[quick reference gdb][]. Also **ddd** is installed on lab workstations.
8 13
 
9
-The second tool you’ll use is [valgrind][]. This tool helps find memory leaks and other insidious memory problems in your program.
14
+The second tool you’ll use is [valgrind][]. This tool helps find memory leaks
15
+and other insidious memory problems in your program.
10 16
 
11
-Please answer the questions, by giving the result and an explanation, why you got the result.  Write your answers in markdown syntax in the new file `ANSWERS.md`. Also checkin your C-Files and one Makefile for all or your C-Files, so that all binaries are build. Do NOT checkin the binaries!
17
+Please answer the questions, by giving the result and an explanation, why you
18
+got the result.  Write your answers in markdown syntax in the new file
19
+`ANSWERS.md`. Also checkin your C-Files and one Makefile for all or your
20
+C-Files, so that all binaries are build. Do NOT checkin the binaries!
12 21
 
13
-The installed gcc wraper on you workstations does some optimization to your code examples, which will not show some of the bugs with an "Segmentation fault". We have already disabled this behaviour by setting:
22
+The installed gcc wrapper on you workstations does some optimization to your code
23
+examples, which will not show some of the bugs with an "Segmentation fault". We
24
+have already disabled this behavior by setting:
14 25
 
15 26
 ```text
16 27
 export hardeningDisable=all
17 28
 ```
18 29
 
19
-in your labshell bsys environment. So, you don't have to do any further steps to produce unoptimized code with gcc, if you want to.
30
+in your labshell bsys environment. So, you don't have to do any further steps to
31
+produce unoptimized code with gcc, if you want to.
20 32
 
21
-If you struggle with your own systems about some strange gcc optimization behaviour, maybe it helps to check for gcc-wrapper variables like these.
33
+If you struggle with your own systems about some strange gcc optimization
34
+behavior, maybe it helps to check for gcc-wrapper variables like these.
22 35
 
23 36
 ## Questions
24 37
 
25
-1. First, write a simple program called `null.c` that creates a pointer to an integer, sets it to `NULL`, and then tries to dereference it. Compile this into an executable called **null**. What happens when you run this program?
26
-
27
-2. Next, compile this program with symbol information included (with the `-g` flag). Doing so let’s put more information into the executable, enabling the debugger to access more useful information about variable names and the like. Run the program under the debugger by typing `gdb null` and then, once gdb is running, typing `run`. What does gdb show you?
28
-
29
-3. Finally, use the valgrind tool on this program. We’ll use the memcheck tool that is a part of valgrind to analyze what happens. Run
30
-   this by typing in the following: `valgrind --leak-check=yes ./null`. What happens when you run this? Can you interpret the output from the tool?
31
-
32
-4. Write a simple program that allocates memory using `malloc()` but forgets to free it before exiting. What happens when this program runs? Can you use `gdb` to find any problems with it? How about `valgrind` (again with the `--leak-check=yes` flag)?
33
-
34
-5. Write aprogram that creates an array of integers of size 100 using `malloc()`; then, set `data[100]` to zero. What happens when you run this program? What happens when you run this program using `valgrind`? Is the program correct?
35
-
36
-6. Create a program that allocates an array of integers (as above),frees them, and then tries to print the value of one of the elements of the array. Does the program run? What happens when you use `valgrind` on it?
37
-
38
-7. Now pass a funny value to free (e.g., a pointer in the middle of the array you allocated above). What happens? Do you need tools to find this type of problem?
39
-
40
-
38
+1. First, write a simple program called `null.c` that creates a pointer to an
39
+   integer, sets it to `NULL`, and then tries to dereference it. Compile this
40
+   into an executable called **null**. What happens when you run this program?
41
+
42
+1. Next, compile this program with symbol information included (with the `-g`
43
+   flag). Doing so let’s put more information into the executable, enabling the
44
+   debugger to access more useful information about variable names and the like.
45
+   Run the program under the debugger by typing `gdb null` and then, once gdb is
46
+   running, typing `run`. What does gdb show you?
47
+
48
+1. Finally, use the valgrind tool on this program. We’ll use the memcheck tool
49
+   that is a part of valgrind to analyze what happens. Run this by typing in the
50
+   following: `valgrind --leak-check=yes ./null`. What happens when you run
51
+   this? Can you interpret the output from the tool?
52
+
53
+1. Write a simple program that allocates memory using `malloc()` but forgets to
54
+   free it before exiting. What happens when this program runs? Can you use
55
+   `gdb` to find any problems with it? How about `valgrind` (again with the
56
+   `--leak-check=yes` flag)?
57
+
58
+1. Write a program that creates an array of integers of size 100 using
59
+   `malloc()`; then, set `data[100]` to zero. What happens when you run this
60
+   program? What happens when you run this program using `valgrind`? Is the
61
+   program correct?
62
+
63
+1. Create a program that allocates an array of integers (as above),frees them,
64
+   and then tries to print the value of one of the elements of the array. Does
65
+   the program run? What happens when you use `valgrind` on it?
66
+
67
+1. Now pass a funny value to free (e.g., a pointer in the middle of the array
68
+   you allocated above). What happens? Do you need tools to find this type of
69
+   problem?
41 70
 
42 71
 [valgrind]: http://valgrind.org/downloads/current.html
43 72
 [quick reference gdb]: https://web.stanford.edu/class/cs107/gdb_refcard.pdf

+ 19
- 22
hw2/task1/README.md Просмотреть файл

@@ -6,24 +6,25 @@ Run the cargo command to prepare your task1/ directory as a library
6 6
 
7 7
 ## task
8 8
 
9
-Calculate the Hamming difference between two DNA strands by implementing 
10
-the library function *hamming_distance(s1: &str, s2: &str) -> Result<usize, String>*.
11
-
12
-A mutation is simply a mistake that occurs during the creation or
13
-copying of a nucleic acid, in particular DNA. Because nucleic acids are
14
-vital to cellular functions, mutations tend to cause a ripple effect
15
-throughout the cell. Although mutations are technically mistakes, a very
16
-rare mutation may equip the cell with a beneficial attribute. In fact,
17
-the macro effects of evolution are attributable by the accumulated
18
-result of beneficial microscopic mutations over many generations.
19
-
20
-The simplest and most common type of nucleic acid mutation is a point
21
-mutation, which replaces one base with another at a single nucleotide.
22
-
23
-By counting the number of differences between two homologous DNA strands
24
-taken from different genomes with a common ancestor, we get a measure of
25
-the minimum number of point mutations that could have occurred on the
26
-evolutionary path between the two strands.
9
+Calculate the Hamming difference between two DNA strands by implementing the
10
+library function *hamming_distance(s1: &str, s2: &str) -> Result<usize,
11
+String>*.
12
+
13
+A mutation is simply a mistake that occurs during the creation or copying of a
14
+nucleic acid, in particular DNA. Because nucleic acids are vital to cellular
15
+functions, mutations tend to cause a ripple effect throughout the cell. Although
16
+mutations are technically mistakes, a very rare mutation may equip the cell with
17
+a beneficial attribute. In fact, the macro effects of evolution are attributable
18
+by the accumulated result of beneficial microscopic mutations over many
19
+generations.
20
+
21
+The simplest and most common type of nucleic acid mutation is a point mutation,
22
+which replaces one base with another at a single nucleotide.
23
+
24
+By counting the number of differences between two homologous DNA strands taken
25
+from different genomes with a common ancestor, we get a measure of the minimum
26
+number of point mutations that could have occurred on the evolutionary path
27
+between the two strands.
27 28
 
28 29
 This is called the 'Hamming distance'.
29 30
 
@@ -35,7 +36,3 @@ nucleotides are different from their equivalent in the other string.
35 36
     ^ ^ ^  ^ ^    ^^
36 37
 
37 38
 The Hamming distance between these two DNA strands is 7.
38
-
39
-
40
-
41
-

+ 6
- 7
hw2/task3/README.md Просмотреть файл

@@ -6,10 +6,13 @@ Run the cargo command to prepare your task3/ directory as a library
6 6
 
7 7
 ## task
8 8
 
9
-Compute Pascal's triangle up to a given number of rows. Create the new type *PascalsTriangle* and implement the methods *new()* and *rows()*. See the `tests/task3.rs` for more informationen about parameters and returns of the methods.
9
+Compute Pascal's triangle up to a given number of rows. Create the new type
10
+*PascalsTriangle* and implement the methods *new()* and *rows()*. See the
11
+`tests/task3.rs` for more informationen about parameters and returns of the
12
+methods.
10 13
 
11
-In Pascal's Triangle each number is computed by adding the numbers to
12
-the right and left of the current position in the previous row.
14
+In Pascal's Triangle each number is computed by adding the numbers to the right
15
+and left of the current position in the previous row.
13 16
 
14 17
 ```plain
15 18
     1
@@ -19,7 +22,3 @@ the right and left of the current position in the previous row.
19 22
 1 4 6 4 1
20 23
 # ... etc
21 24
 ```
22
-
23
-
24
-
25
-

Загрузка…
Отмена
Сохранить