Browse Source

fix errors and normalize style in subjects

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

2
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

3
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

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
```

2
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

1
subjects/btreedeletenode.md

@ -1,4 +1,5 @@
## btreedeletenode
### Instructions
Write a function, BTreeDeleteNode, that deletes 'node' from the tree given by root.

2
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

2
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

2
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

2
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

2
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

2
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

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 :

2
subjects/compact.md

@ -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

2
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

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`.

3
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

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 :

3
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

1
subjects/onlyz.md

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

2
subjects/pilot.md

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

4
subjects/point.md

@ -1,4 +1,4 @@
# Point
## Point
### Instructions
@ -6,8 +6,6 @@ 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

5
subjects/rectangle.md

@ -21,11 +21,11 @@ is defined by the points of the upper left and lower right corners.
```go
func defineRectangle(ptr *point, n int) *rectangle {
//complete here
}
func calArea(ptr *rectangle) int {
//complete here
}
func main() {
@ -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.

10
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
```

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/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 :

11
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
subjects/union.md

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

3
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

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