Browse Source

formatting

content-update
Christopher Fremond 5 years ago
parent
commit
973c18f73d
  1. 6
      subjects/fprime.en.md
  2. 8
      subjects/revwstr.en.md
  3. 31
      subjects/sortList.en.md

6
subjects/fprime.en.md

@ -6,9 +6,9 @@ Write a program that takes a positive `int` and displays its prime factors on th
- Factors must be displayed in ascending order and separated by `*`, so that the expression in the output gives the right result.
- If the number of parameters is not 1, simply display a newline.
- If the number of parameters is not 1, the program displays a newline.
- The input, when there's one, will be valid.
- The input, when there is one, will always be valid.
Example of output :
@ -27,4 +27,4 @@ student@ubuntu:~/piscine/test$ ./test 42
student@ubuntu:~/piscine/test$ ./test
student@ubuntu:~/piscine/test$
```
```

8
subjects/revwstr.en.md

@ -4,13 +4,13 @@
Write a program that takes a string as a parameter, and prints its words in reverse.
- A "word" is a part of the string bounded by spaces and/or tabs, or the begin/end of the string.
- A word is a sequence of **alphanumerical** characters.
- If the number of parameters is different from 1, the program will display `\n`.
- In the parameters that are going to be tested, there won't be any additional" spaces (meaning that there won't be additionnal spaces at the beginning or at the end of the string, and words will always be separated by exactly one space).
- In the parameters that are going to be tested, there will not be any additional spaces. (meaning that there will not be additionnal spaces at the beginning or at the end of the string, and words will always be separated by exactly one space).
Example of output :
Examples of outputs :
```console
student@ubuntu:~/piscine/test$ go build
@ -23,4 +23,4 @@ mountain the at stared he
student@ubuntu:~/piscine/test$ ./test
student@ubuntu:~/piscine/test$
```
```

31
subjects/sortList.en.md

@ -2,24 +2,29 @@
### Instructions
Write the following function:
Write a function that must:
```go
func SortList (l *NodeList, cmp func(a,b int) bool) *NodeList{
}
```
- This function must sort the list given as a parameter, using the function cmp to select the order to apply, and returns a pointer to the first element of the sorted list.
- Sort the list given as a parameter, using the function cmp to select the order to apply,
- Duplications must remain.
- Return a pointer to the first element of the sorted list.
- Input will always be consistent.
Duplications must remain.
- You must use the `type NodeList`.
Inputs will always be consistent.
- Functions passed as cmp will always return a value different from 0 if a and b are in the right order, 0 otherwise.
The `type NodeList` must be used.
- For example, the following function used as cmp will sort the list in ascending order :
Functions passed as `cmp` will always return `true` if `a` and `b` are in the right order, otherwise it will return `false`.
### Expected function
```go
func SortList (l *NodeList, cmp func(a,b int) bool) *NodeList{
}
```
- For example, the following function used as `cmp` will sort the list in ascending order :
```go
func ascending(a, b int) bool{
@ -29,4 +34,4 @@ func ascending(a, b int) bool{
return false
}
}
```
```

Loading…
Cancel
Save