Browse Source

fix errors and normalize style in subjects

content-update
Clement Denis 5 years ago committed by Frenchris
parent
commit
2c3592e5fc
  1. 6
      subjects/abort.md
  2. 7
      subjects/activebits.md
  3. 12
      subjects/bool.md
  4. 6
      subjects/btreeapplybylevel.md
  5. 5
      subjects/btreedeletenode.md
  6. 6
      subjects/btreeisbinary.md
  7. 6
      subjects/btreelevelcount.md
  8. 6
      subjects/btreemax.md
  9. 6
      subjects/btreemin.md
  10. 6
      subjects/btreetransplant.md
  11. 4
      subjects/cat.md
  12. 6
      subjects/collatzcountdown.md
  13. 1
      subjects/comcheck.md
  14. 4
      subjects/compact.md
  15. 1
      subjects/createelem.md
  16. 1
      subjects/displayalpham.md
  17. 1
      subjects/displayalrevm.md
  18. 4
      subjects/displayfile.md
  19. 6
      subjects/enigma.md
  20. 1
      subjects/fixthemain.md
  21. 1
      subjects/inter.md
  22. 7
      subjects/join.md
  23. 1
      subjects/lastword.md
  24. 1
      subjects/listat.md
  25. 1
      subjects/listclear.md
  26. 1
      subjects/listforeachif.md
  27. 3
      subjects/listlast.md
  28. 2
      subjects/listpushfront.md
  29. 4
      subjects/listpushpara.md
  30. 2
      subjects/listremoveif.md
  31. 1
      subjects/listsize.md
  32. 2
      subjects/listsort.md
  33. 7
      subjects/max.md
  34. 1
      subjects/onlyz.md
  35. 6
      subjects/pilot.md
  36. 16
      subjects/point.md
  37. 13
      subjects/rectangle.md
  38. 3
      subjects/repeatalpha.md
  39. 20
      subjects/reversebits.md
  40. 2
      subjects/rot14.md
  41. 2
      subjects/searchreplace.md
  42. 2
      subjects/sortlistinsert.md
  43. 2
      subjects/strlen.md
  44. 21
      subjects/swapbits.md
  45. 2
      subjects/switchcase.md
  46. 1
      subjects/union.md
  47. 7
      subjects/unmatch.md
  48. 1
      subjects/wdmatch.md
  49. 2
      subjects/ztail.md

6
subjects/abort.md

@ -1,4 +1,5 @@
## abort
### Instructions
Write a function that returns the the value in the middle of 5 five arguments.
@ -11,7 +12,6 @@ This function must have the following signature.
func Abort(a, b, c, d, e int) int {
}
```
### Usage
@ -22,8 +22,8 @@ Here is a possible [program](TODO-LINK) to test your function :
package main
import (
"fmt"
student ".."
"fmt"
student ".."
)
func main() {

7
subjects/activebits.md

@ -1,4 +1,5 @@
## activebits
### Instructions
Write a function, ActiveBitsthat, that returns the number of active bits (bits with the value 1) in the binary representation of an integer number.
@ -8,11 +9,9 @@ The function must have the next signature.
### Expected function
```go
func ActiveBits(n int) uint {
}
```
### Usage
@ -23,8 +22,8 @@ Here is a possible [program](TODO-LINK) to test your function :
package main
import (
"fmt"
student ".."
"fmt"
student ".."
)
func main() {

12
subjects/bool.md

@ -1,4 +1,4 @@
# Boolean
## Boolean
### Instructions
@ -7,7 +7,6 @@ Create a `.go` file and copy the code below into our file
- The main task is to return a working program.
```go
func printStr(str string) {
arrayStr := []rune(str)
@ -18,7 +17,6 @@ func printStr(str string) {
}
func isEven(nbr int) boolean {
if even(nbr) == 1 {
return yes
} else {
@ -27,7 +25,6 @@ func isEven(nbr int) boolean {
}
func main() {
if isEven(lengthOfArg) == 1 {
printStr(EvenMsg)
} else {
@ -37,10 +34,13 @@ func main() {
```
### Expected output
```go
```console
I have an even number of arguments
```
### Or
```go
```console
I have an odd number of arguments
```

6
subjects/btreeapplybylevel.md

@ -1,4 +1,5 @@
## btreeapplybylevel
### Instructions
Write a function, BTreeApplyByLevel, that applies the function given by fn to each node of the tree given by root.
@ -11,7 +12,6 @@ This function must have the following signature.
func BTreeApplyByLevel(root *TreeNode, fn interface{}) {
}
```
### Usage
@ -22,8 +22,8 @@ Here is a possible [program](TODO-LINK) to test your function :
package main
import (
"fmt"
student ".."
"fmt"
student ".."
)
func main() {

5
subjects/btreedeletenode.md

@ -1,4 +1,5 @@
## btreedeletenode
### Instructions
Write a function, BTreeDeleteNode, that deletes 'node' from the tree given by root.
@ -24,8 +25,8 @@ Here is a possible [program](TODO-LINK) to test your function :
package main
import (
"fmt"
student ".."
"fmt"
student ".."
)
func main() {

6
subjects/btreeisbinary.md

@ -1,4 +1,5 @@
## btreeisbinary
### Instructions
Write a function, BTreeIsBinary, that returns true only if the tree given by root follows the binary search tree properties.
@ -11,7 +12,6 @@ This function must have the following signature.
func BTreeIsBinary(root *TreeNode) bool {
}
```
### Usage
@ -22,8 +22,8 @@ Here is a possible [program](TODO-LINK) to test your function :
package main
import (
"fmt"
student ".."
"fmt"
student ".."
)
func main() {

6
subjects/btreelevelcount.md

@ -1,4 +1,5 @@
## btreelevelcount
### Instructions
Write a function, BTreeLevelCount, that return the number of levels of the tree (height of the tree)
@ -9,7 +10,6 @@ Write a function, BTreeLevelCount, that return the number of levels of the tree
func BTreeLevelCount(root *piscine.TreeNode) int {
}
```
### Usage
@ -20,8 +20,8 @@ Here is a possible [program](TODO-LINK) to test your function :
package main
import (
"fmt"
student ".."
"fmt"
student ".."
)
func main() {

6
subjects/btreemax.md

@ -1,4 +1,5 @@
## btreemax
### Instructions
Write a function, BTreeMax, that returns the node with the maximum value in the tree given by root
@ -11,7 +12,6 @@ This function must have the following signature.
func BTreeMax(root *TreeNode) *TreeNode {
}
```
### Usage
@ -22,8 +22,8 @@ Here is a possible [program](TODO-LINK) to test your function :
package main
import (
"fmt"
student ".."
"fmt"
student ".."
)
func main() {

6
subjects/btreemin.md

@ -1,4 +1,5 @@
## btreemin
### Instructions
Write a function, BTreeMin, that returns the node with the minimum value in the tree given by root
@ -11,7 +12,6 @@ This function must have the following signature.
func BTreeMin(root *TreeNode) *TreeNode {
}
```
### Usage
@ -22,8 +22,8 @@ Here is a possible [program](TODO-LINK) to test your function :
package main
import (
"fmt"
student ".."
"fmt"
student ".."
)
func main() {

6
subjects/btreetransplant.md

@ -1,4 +1,5 @@
## btreetransplant
### Instructions
In order to move subtrees around within the binary search tree, write a function, BTreeTransplant, which replaces the subtree started by node with the node called 'rplc' in the tree given by root.
@ -11,7 +12,6 @@ This function must have the following signature.
func BTreeTransplant(root, node, rplc *TreeNode) *TreeNode {
}
```
### Usage
@ -22,8 +22,8 @@ Here is a possible [program](TODO-LINK) to test your function :
package main
import (
"fmt"
student ".."
"fmt"
student ".."
)
func main() {

4
subjects/cat.md

@ -12,11 +12,11 @@ Write a program that does the same thing as the system's `cat` command-line.
- Copy to the `quest8.txt` file this :
- "Programming is a skill best acquired by pratice and example rather than from books" by Alan Turing
- "Programming is a skill best acquired by pratice and example rather than from books" by Alan Turing
- Copy to the `quest8T.txt` file this :
- "Alan Mathison Turing was an English mathematician, computer scientist, logician, cryptanalyst. Turing was highly influential in the development of theoretical computer science, providing a formalisation of the concepts of algorithm and computation with the Turing machine, which can be considered a model of a general-purpose computer. Turing is widely considered to be the father of theoretical computer science and artificial intelligence."
- "Alan Mathison Turing was an English mathematician, computer scientist, logician, cryptanalyst. Turing was highly influential in the development of theoretical computer science, providing a formalisation of the concepts of algorithm and computation with the Turing machine, which can be considered a model of a general-purpose computer. Turing is widely considered to be the father of theoretical computer science and artificial intelligence."
- In case of error it should print the error.

6
subjects/collatzcountdown.md

@ -1,4 +1,5 @@
## collatzcountdown
### Instructions
Write a function, CollatzCountdown, that returns the number of steps to reach 1 using the collatz countdown.
@ -11,7 +12,6 @@ The function must have the following signature.
func CollatzCountdown(start int) int {
}
```
### Usage
@ -22,8 +22,8 @@ Here is a possible [program](TODO-LINK) to test your function :
package main
import (
"fmt"
student ".."
"fmt"
student ".."
)
func main() {

1
subjects/comcheck.md

@ -13,6 +13,7 @@ func rot14(str string) string {
}
```
### Usage
Here is a possible [program](TODO-LINK) to test your function :

4
subjects/compact.md

@ -4,7 +4,7 @@
Write a function that will take a pointer to a array as parameter and overwrites any element that points to `nil`.
- If you not sure what the function does. It exists in Ruby.
- If you not sure what the function does. It exists in Ruby.
### Expected functions
@ -13,6 +13,7 @@ func Compact(ptr *[]string, length int) int {
}
```
### Usage
Here is a possible [program](TODO-LINK) to test your function :
@ -28,7 +29,6 @@ func main() {
ptr := &array
fmt.Println(Compact(ptr, len(array)))
}
```
And its output :

1
subjects/createelem.md

@ -14,7 +14,6 @@ type Node struct {
func CreateElem(n *Node, value int) {
}
```
### Usage

1
subjects/displayalpham.md

@ -1,4 +1,5 @@
## displayalpham
### Instructions
Write a program that displays the alphabet, with even letters in uppercase, and

1
subjects/displayalrevm.md

@ -1,4 +1,5 @@
## displayalrevm
### Instructions
Write a program that displays the alphabet in reverse, with even letters in

4
subjects/displayfile.md

@ -9,8 +9,8 @@ Write a program that displays, on the standard output, only the content of the f
- The argument of the program should be the name of the file, in this case, `quest8.txt`.
- In case of error it should print:
- `File name missing`.
- `Too many arguments`.
- `File name missing`.
- `Too many arguments`.
### Output:

6
subjects/enigma.md

@ -1,4 +1,5 @@
## enigma
### Instructions
Write a function called `Enigma` that receives poiters to functions and move its values around to hide them
@ -13,7 +14,6 @@ This function must have the following signature.
func Enigma(a ***int, b *int, c *******int, d ****int) {
}
```
### Usage
@ -24,8 +24,8 @@ Here is a possible [program](TODO-LINK) to test your function :
package main
import (
"fmt"
student ".."
"fmt"
student ".."
)
func main() {

1
subjects/fixthemain.md

@ -29,6 +29,7 @@ func IsDoorClose(ptrDoor *Door) bool {
PutStr("Door is close ?")
}
```
### Usage
Here is a possible [program](TODO-LINK) to test your function :

1
subjects/inter.md

@ -2,7 +2,6 @@
### Instructions
Write a program that takes two strings and displays, without doubles, the characters that appear in both strings, in the order they appear in the first one.
- The display will be followed by a `\n`.

7
subjects/join.md

@ -1,4 +1,5 @@
## join
### Instructions
Write a function, Join, that returns the elements of a slice strings (arstr) join together in one string. Using the string 'sep' as a separator between each element of the array
@ -8,11 +9,9 @@ The function must have the next signature.
### Expected function
```go
func Join(arstr []string, sep string) string {
}
```
### Usage
@ -23,8 +22,8 @@ Here is a possible [program](TODO-LINK) to test your function :
package main
import (
"fmt"
student ".."
"fmt"
student ".."
)
func main() {

1
subjects/lastword.md

@ -1,4 +1,5 @@
## lastword
### Instructions
Write a program that takes a string and displays its last word, followed by a

1
subjects/listat.md

@ -46,7 +46,6 @@ func main() {
fmt.Println(ListAt(link, 1).Data)
fmt.Println(ListAt(link, 7))
}
```
And its output :

1
subjects/listclear.md

@ -62,7 +62,6 @@ func main() {
fmt.Println("------updated list------")
PrintList(link)
}
```
And its output :

1
subjects/listforeachif.md

@ -62,6 +62,7 @@ func PrintList(l *list) {
fmt.Print(l.tail)
}
func main() {
link := &list{}

3
subjects/listlast.md

@ -18,6 +18,7 @@ type List struct {
}
func ListLast(l *list) *list {
}
```
@ -33,7 +34,6 @@ import (
piscine ".."
)
func main() {
link := &list{}
link2 := &list{}
@ -45,7 +45,6 @@ func main() {
fmt.Println(piscine.ListLast(link).head)
fmt.Println(piscine.ListLast(link2).head)
}
```
And its output :

2
subjects/listpushfront.md

@ -18,6 +18,7 @@ type List struct {
}
func ListPushFront(l *list, data interface{}) {
}
```
@ -34,7 +35,6 @@ import (
)
func main() {
link := &list{}
piscine.ListPushFront(link, "Hello")

4
subjects/listpushpara.md

@ -1,4 +1,4 @@
## listpushback
## listpushpara
### Instructions
@ -6,8 +6,6 @@ Write a program that creates a new linked list and includes each command-line ar
- The first argument should be at the end of the list
```
And its output :
```console

2
subjects/listremoveif.md

@ -6,7 +6,6 @@ Write a function `ListRemoveIf` that removes all elements that are equal to the
- Use pointers wen ever you can.
### Expected function and structure
```go
@ -80,7 +79,6 @@ func main() {
fmt.Println("------answer-----")
PrintList(link)
}
```
And its output :

1
subjects/listsize.md

@ -44,7 +44,6 @@ func main() {
fmt.Println(piscine.ListSize(link))
}
```
And its output :

2
subjects/listsort.md

@ -76,9 +76,7 @@ func main() {
listPushBack(link, 1)
PrintList(student.ListSort(link))
}
```
And its output :

7
subjects/max.md

@ -1,4 +1,5 @@
## max
### Instructions
Write a function, Max, that returns the maximum value in a slice of integers
@ -8,11 +9,9 @@ The function must have the next signature.
### Expected function
```go
func Max(arr []int) int {
}
```
### Usage
@ -23,8 +22,8 @@ Here is a possible [program](TODO-LINK) to test your function :
package main
import (
"fmt"
student ".."
"fmt"
student ".."
)
func main() {

1
subjects/onlyz.md

@ -1,4 +1,5 @@
## displayalpham
### Instructions
Write a program that displays a 'z' character on the standard output.

6
subjects/pilot.md

@ -1,4 +1,5 @@
## pilot
### Instructions
Write a go file so that the following program compile
@ -9,8 +10,8 @@ Write a go file so that the following program compile
package main
import (
"fmt"
student ".."
"fmt"
student ".."
)
func main() {
@ -23,4 +24,3 @@ func main() {
fmt.Println(donnie)
}
```

16
subjects/point.md

@ -1,4 +1,4 @@
# Point
## Point
### Instructions
@ -6,21 +6,19 @@ Create a `.go` file and copy the code below into our file
- The main task is to return a working program.
-
```go
func setPoint(ptr *point) {
ptr.x = 42
ptr.y = 21
ptr.x = 42
ptr.y = 21
}
func main() {
points := &point{}
points := &point{}
setPoint(points)
setPoint(points)
fmt.Printf("x = %d, y = %d",points.x, points.y)
fmt.Println()
fmt.Printf("x = %d, y = %d",points.x, points.y)
fmt.Println()
}
```

13
subjects/rectangle.md

@ -13,29 +13,29 @@ is defined by the points of the upper left and lower right corners.
- Our main task is to make a program that:
- Given a slice of points of size `n` returns the smallest rectangle that contains all the points in the vector of points. The name of that function is `defineRectangle`
- Given a slice of points of size `n` returns the smallest rectangle that contains all the points in the vector of points. The name of that function is `defineRectangle`
- And calculates and prints the area of that rectangle you define.
- And calculates and prints the area of that rectangle you define.
### Expected main and function for the program
```go
func defineRectangle(ptr *point, n int) *rectangle {
//complete here
}
func calArea(ptr *rectangle) int {
//complete here
}
func main() {
vPoint := []point{}
vPoint := []point{}
rectangle := &rectangle{}
n := 7
for i := 0; i < n; i++ {
val := point{
x: i%2 + 1,
x: i%2 + 1,
y: i + 2,
}
vPoint = append(vPoint, val)
@ -45,7 +45,6 @@ func main() {
}
```
### Expected output
```console

3
subjects/repeatalpha.md

@ -1,11 +1,12 @@
## repeatalpha
### Instructions
Write a program called repeat_alpha that takes a string and display it
repeating each alphabetical character as many times as its alphabetical index,
followed by a newline.
'a' becomes 'a', 'b' becomes 'bb', 'e' becomes 'eeeee', etc...
`'a'` becomes `'a'`, `'b'` becomes `'bb'`, `'e'` becomes `'eeeee'`, etc...
Case remains unchanged.

20
subjects/reversebits.md

@ -1,4 +1,5 @@
## reversebits
### Instructions
Write a function that takes a byte, reverses it, bit by bit (like the
@ -6,15 +7,20 @@ example) and returns the result.
Your function must be declared as follows:
```go
func ReverseBits(octet byte) byte {
...
}
```
Example:
1 byte
_____________
00100110
||
\/
01100100
1 byte
---
```
00100110
||
\/
01100100
```

2
subjects/rot14.md

@ -13,6 +13,7 @@ func rot14(str string) string {
}
```
### Usage
Here is a possible [program](TODO-LINK) to test your function :
@ -33,7 +34,6 @@ func main() {
}
z01.PrintRune('\n')
}
```
And its output :

2
subjects/searchreplace.md

@ -2,7 +2,7 @@
### Instructions
Write a program that takes 3 arguments, the first arguments is a string in which to replace a letter (2nd argument) by another one (3rd argument).
Write a program that takes 3 arguments, the first arguments is a string in which to replace a letter (2nd argument) by another one (3rd argument).
- If the number of arguments is not 3, just display a newline.

2
subjects/sortlistinsert.md

@ -43,6 +43,7 @@ func PrintList(l *Nodee) {
fmt.Print(nil)
fmt.Println()
}
//insert elements
func listPushBack(l *Nodee, Data int) {
n := &Nodee{}
@ -73,7 +74,6 @@ func main() {
link = sortListInsert(link, 2)
PrintList(link)
}
```
And its output :

2
subjects/strlen.md

@ -4,7 +4,7 @@
Write a function that returns the length of a string.
- `len` is forbidden
- `len` is forbidden
### Expected function and structure

21
subjects/swapbits.md

@ -1,4 +1,5 @@
## swapbits
### Instructions
Write a function that takes a byte, swaps its halves (like the example) and
@ -6,15 +7,21 @@ returns the result.
Your function must be declared as follows:
```go
func SwapBits(octet byte) byte {
...
}
```
Example:
1 byte
_____________
0100 | 0001
\ /
/ \
0001 | 0100
1 byte
---
```
0100 | 0001
\ /
/ \
0001 | 0100
````

2
subjects/switchcase.md

@ -2,7 +2,7 @@
### Instructions
Write a program that takes a string and reverses the case of all its letters.
Write a program that takes a string and reverses the case of all its letters.
- Other characters remain unchanged.

1
subjects/union.md

@ -1,4 +1,5 @@
## union
### Instructions
Write a program that takes two strings and displays, without doubles, the

7
subjects/unmatch.md

@ -1,4 +1,5 @@
## join
### Instructions
Write a function, Unmatch, that returns the element of the slice (arr) that does not have a correspondent pair.
@ -8,11 +9,9 @@ The function must have the next signature.
### Expected function
```go
func Unmatch(arr []int) int {
}
```
### Usage
@ -23,8 +22,8 @@ Here is a possible [program](TODO-LINK) to test your function :
package main
import (
"fmt"
student ".."
"fmt"
student ".."
)
func main() {

1
subjects/wdmatch.md

@ -2,7 +2,6 @@
### Instructions
Write a program that takes two strings and checks whether it's possible to write the first string with characters from the second string, while respecting the order in which these characters appear in the second string.
- If it's possible, the program displays the string followed by a `\n`, otherwise it simply displays a `\n`.

2
subjects/ztail.md

@ -1,4 +1,5 @@
## ztail
### Instructions
Write a program called ztail that does the same thing as the system command tail, but witch takes at least one file as argument.
@ -10,4 +11,3 @@ For this program you can use the "os" package.
For the program to pass the test you should follow the convention for the return code of program in Unix sistems (see os.Exit)
For more information consult the man page for tail.

Loading…
Cancel
Save