mirror of https://github.com/01-edu/public.git
parent
1142d34291
commit
25dad2b1c8
|
@ -1,11 +1,11 @@
|
|||
# abort
|
||||
## Instructions
|
||||
## abort
|
||||
### Instructions
|
||||
|
||||
Write a function that returns the the value in the middle of 5 five arguments.
|
||||
|
||||
This function must have the following signature.
|
||||
|
||||
## Expected function
|
||||
### Expected function
|
||||
|
||||
```go
|
||||
func Abort(a, b, c, d, e int) int {
|
||||
|
@ -14,7 +14,7 @@ func Abort(a, b, c, d, e int) int {
|
|||
|
||||
```
|
||||
|
||||
## Usage
|
||||
### Usage
|
||||
|
||||
Here is a possible [program](TODO-LINK) to test your function :
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
# activebits
|
||||
## Instructions
|
||||
## 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.
|
||||
|
||||
The function must have the next signature.
|
||||
|
||||
## Expected function
|
||||
### Expected function
|
||||
|
||||
```go
|
||||
|
||||
|
@ -15,7 +15,7 @@ func ActiveBits(n int) uint {
|
|||
|
||||
```
|
||||
|
||||
## Usage
|
||||
### Usage
|
||||
|
||||
Here is a possible [program](TODO-LINK) to test your function :
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Boolean
|
||||
|
||||
## Instructions
|
||||
### Instructions
|
||||
|
||||
Create a `.go` file and copy the code below into our file
|
||||
|
||||
|
@ -36,11 +36,11 @@ func main() {
|
|||
}
|
||||
```
|
||||
|
||||
## Expected output
|
||||
### Expected output
|
||||
```go
|
||||
I have an even number of arguments
|
||||
```
|
||||
## Or
|
||||
### Or
|
||||
```go
|
||||
I have an odd number of arguments
|
||||
```
|
|
@ -1,11 +1,11 @@
|
|||
# btreeapplybylevel
|
||||
## Instructions
|
||||
## btreeapplybylevel
|
||||
### Instructions
|
||||
|
||||
Write a function, BTreeApplyByLevel, that applies the function given by fn to each node of the tree given by root.
|
||||
|
||||
This function must have the following signature.
|
||||
|
||||
## Expected function
|
||||
### Expected function
|
||||
|
||||
```go
|
||||
func BTreeApplyByLevel(root *TreeNode, fn interface{}) {
|
||||
|
@ -14,7 +14,7 @@ func BTreeApplyByLevel(root *TreeNode, fn interface{}) {
|
|||
|
||||
```
|
||||
|
||||
## Usage
|
||||
### Usage
|
||||
|
||||
Here is a possible [program](TODO-LINK) to test your function :
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# btreedeletenode
|
||||
## Instructions
|
||||
## btreedeletenode
|
||||
### Instructions
|
||||
|
||||
Write a function, BTreeDeleteNode, that deletes 'node' from the tree given by root.
|
||||
|
||||
|
@ -7,7 +7,7 @@ The resulting tree should still follow the binary search tree rules.
|
|||
|
||||
This function must have the following signature.
|
||||
|
||||
## Expected function
|
||||
### Expected function
|
||||
|
||||
```go
|
||||
func BTreeDeleteNode(root, node *TreeNode) *TreeNode {
|
||||
|
@ -16,7 +16,7 @@ func BTreeDeleteNode(root, node *TreeNode) *TreeNode {
|
|||
|
||||
```
|
||||
|
||||
## Usage
|
||||
### Usage
|
||||
|
||||
Here is a possible [program](TODO-LINK) to test your function :
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
# btreeisbinary
|
||||
## Instructions
|
||||
## btreeisbinary
|
||||
### Instructions
|
||||
|
||||
Write a function, BTreeIsBinary, that returns true only if the tree given by root follows the binary search tree properties.
|
||||
|
||||
This function must have the following signature.
|
||||
|
||||
## Expected function
|
||||
### Expected function
|
||||
|
||||
```go
|
||||
func BTreeIsBinary(root *TreeNode) bool {
|
||||
|
@ -14,7 +14,7 @@ func BTreeIsBinary(root *TreeNode) bool {
|
|||
|
||||
```
|
||||
|
||||
## Usage
|
||||
### Usage
|
||||
|
||||
Here is a possible [program](TODO-LINK) to test your function :
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
# btreelevelcount
|
||||
## Instructions
|
||||
## btreelevelcount
|
||||
### Instructions
|
||||
|
||||
Write a function, BTreeLevelCount, that return the number of levels of the tree (height of the tree)
|
||||
|
||||
## Expected function
|
||||
### Expected function
|
||||
|
||||
```go
|
||||
func BTreeLevelCount(root *piscine.TreeNode) int {
|
||||
|
@ -12,7 +12,7 @@ func BTreeLevelCount(root *piscine.TreeNode) int {
|
|||
|
||||
```
|
||||
|
||||
## Usage
|
||||
### Usage
|
||||
|
||||
Here is a possible [program](TODO-LINK) to test your function :
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
# btreemax
|
||||
## Instructions
|
||||
## btreemax
|
||||
### Instructions
|
||||
|
||||
Write a function, BTreeMax, that returns the node with the maximum value in the tree given by root
|
||||
|
||||
This function must have the following signature.
|
||||
|
||||
## Expected function
|
||||
### Expected function
|
||||
|
||||
```go
|
||||
func BTreeMax(root *TreeNode) *TreeNode {
|
||||
|
@ -14,7 +14,7 @@ func BTreeMax(root *TreeNode) *TreeNode {
|
|||
|
||||
```
|
||||
|
||||
## Usage
|
||||
### Usage
|
||||
|
||||
Here is a possible [program](TODO-LINK) to test your function :
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
# btreemin
|
||||
## Instructions
|
||||
## btreemin
|
||||
### Instructions
|
||||
|
||||
Write a function, BTreeMin, that returns the node with the minimum value in the tree given by root
|
||||
|
||||
This function must have the following signature.
|
||||
|
||||
## Expected function
|
||||
### Expected function
|
||||
|
||||
```go
|
||||
func BTreeMin(root *TreeNode) *TreeNode {
|
||||
|
@ -14,7 +14,7 @@ func BTreeMin(root *TreeNode) *TreeNode {
|
|||
|
||||
```
|
||||
|
||||
## Usage
|
||||
### Usage
|
||||
|
||||
Here is a possible [program](TODO-LINK) to test your function :
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
# btreetransplant
|
||||
## Instructions
|
||||
## 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.
|
||||
|
||||
This function must have the following signature.
|
||||
|
||||
## Expected function
|
||||
### Expected function
|
||||
|
||||
```go
|
||||
func BTreeTransplant(root, node, rplc *TreeNode) *TreeNode {
|
||||
|
@ -14,7 +14,7 @@ func BTreeTransplant(root, node, rplc *TreeNode) *TreeNode {
|
|||
|
||||
```
|
||||
|
||||
## Usage
|
||||
### Usage
|
||||
|
||||
Here is a possible [program](TODO-LINK) to test your function :
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Cat
|
||||
## Cat
|
||||
|
||||
## Instructions
|
||||
### Instructions
|
||||
|
||||
Write a program that does the same thing as the system's `cat` command-line.
|
||||
|
||||
|
@ -20,7 +20,7 @@ Write a program that does the same thing as the system's `cat` command-line.
|
|||
|
||||
- In case of error it should print the error.
|
||||
|
||||
## Output:
|
||||
### Output:
|
||||
|
||||
```console
|
||||
student@ubuntu:~/student/test$ go build
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
# collatzcountdown
|
||||
## Instructions
|
||||
## collatzcountdown
|
||||
### Instructions
|
||||
|
||||
Write a function, CollatzCountdown, that returns the number of steps to reach 1 using the collatz countdown.
|
||||
|
||||
The function must have the following signature.
|
||||
|
||||
## Expected function
|
||||
### Expected function
|
||||
|
||||
```go
|
||||
func CollatzCountdown(start int) int {
|
||||
|
@ -14,7 +14,7 @@ func CollatzCountdown(start int) int {
|
|||
|
||||
```
|
||||
|
||||
## Usage
|
||||
### Usage
|
||||
|
||||
Here is a possible [program](TODO-LINK) to test your function :
|
||||
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
# ROT 14
|
||||
## ROT 14
|
||||
|
||||
## Instructions
|
||||
### Instructions
|
||||
|
||||
Write a function `rot14` that returns the string within the parameter but transformed into a rot14 string.
|
||||
|
||||
- If you not certain what we are talking about, there is a rot13 already.
|
||||
|
||||
## Expected function
|
||||
### Expected function
|
||||
|
||||
```go
|
||||
func rot14(str string) string {
|
||||
|
||||
}
|
||||
```
|
||||
## Usage
|
||||
### Usage
|
||||
|
||||
Here is a possible [program](TODO-LINK) to test your function :
|
||||
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
# Compact
|
||||
## Compact
|
||||
|
||||
## Instructions
|
||||
### Instructions
|
||||
|
||||
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.
|
||||
|
||||
## Expected functions
|
||||
### Expected functions
|
||||
|
||||
```go
|
||||
func Compact(ptr *[]string, length int) int {
|
||||
|
||||
}
|
||||
```
|
||||
## Usage
|
||||
### Usage
|
||||
|
||||
Here is a possible [program](TODO-LINK) to test your function :
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
# countdown
|
||||
## countdown
|
||||
|
||||
## Instructions
|
||||
### Instructions
|
||||
|
||||
Write a program that displays all digits in descending order, followed by a
|
||||
newline.
|
||||
|
||||
## Expected main and function for the program
|
||||
### Expected main and function for the program
|
||||
|
||||
## Expected output
|
||||
### Expected output
|
||||
|
||||
```console
|
||||
student@ubuntu:~/piscine/test$ go build
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
# createelem
|
||||
## createelem
|
||||
|
||||
## Instructions
|
||||
### Instructions
|
||||
|
||||
Write a function `CreateElem` that creates a new element of type`Node`.
|
||||
|
||||
## Expected function and structure
|
||||
### Expected function and structure
|
||||
|
||||
```go
|
||||
type Node struct {
|
||||
|
@ -17,7 +17,7 @@ func CreateElem(n *Node, value int) {
|
|||
|
||||
```
|
||||
|
||||
## Usage
|
||||
### Usage
|
||||
|
||||
Here is a possible [program](TODO-LINK) to test your function :
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
# dispfirstpar
|
||||
## dispfirstpar
|
||||
|
||||
## Instructions
|
||||
### Instructions
|
||||
|
||||
Write a program that takes strings as arguments, and displays its first argument.
|
||||
|
||||
## Expected output
|
||||
### Expected output
|
||||
|
||||
```console
|
||||
student@ubuntu:~/piscine/test$ go build
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
# displastpar
|
||||
## displastpar
|
||||
|
||||
## Instructions
|
||||
### Instructions
|
||||
|
||||
Write a program that takes strings as arguments, and displays its last argument.
|
||||
|
||||
## Expected output
|
||||
### Expected output
|
||||
|
||||
```console
|
||||
student@ubuntu:~/piscine/test$ go build
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
# displaya
|
||||
## displaya
|
||||
|
||||
## Instructions
|
||||
### Instructions
|
||||
|
||||
Write a program that takes a string, and displays the first 'a' character it
|
||||
encounters in it, followed by a newline. If there are no 'a' characters in the
|
||||
string, the program just writes a newline. If the number of parameters is not
|
||||
1, the program displays 'a' followed by a newline.
|
||||
|
||||
## Expected main and function for the program
|
||||
### Expected main and function for the program
|
||||
|
||||
## Expected output
|
||||
### Expected output
|
||||
|
||||
```console
|
||||
student@ubuntu:~/piscine/test$ go build
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# displayalpham
|
||||
## Instructions
|
||||
## displayalpham
|
||||
### Instructions
|
||||
|
||||
Write a program that displays the alphabet, with even letters in uppercase, and
|
||||
odd letters in lowercase, followed by a newline.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# displayalrevm
|
||||
## Instructions
|
||||
## displayalrevm
|
||||
### Instructions
|
||||
|
||||
Write a program that displays the alphabet in reverse, with even letters in
|
||||
uppercase, and odd letters in lowercase, followed by a newline.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Display File
|
||||
## Display File
|
||||
|
||||
## Instructions
|
||||
### Instructions
|
||||
|
||||
Write a program that displays, on the standard output, only the content of the file given as argument.
|
||||
|
||||
|
@ -12,7 +12,7 @@ Write a program that displays, on the standard output, only the content of the f
|
|||
- `File name missing`.
|
||||
- `Too many arguments`.
|
||||
|
||||
## Output:
|
||||
### Output:
|
||||
|
||||
```console
|
||||
student@ubuntu:~/student/test$ go build
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
# displayz
|
||||
## displayz
|
||||
|
||||
## Instructions
|
||||
### Instructions
|
||||
|
||||
Write a program that takes a string, and displays the first 'a' character it
|
||||
encounters in it, followed by a newline. If there are no 'a' characters in the
|
||||
string, the program just writes a newline. If the number of parameters is not
|
||||
1, the program displays 'a' followed by a newline.
|
||||
|
||||
## Expected output
|
||||
### Expected output
|
||||
|
||||
```console
|
||||
student@ubuntu:~/piscine/test$ go build
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# enigma
|
||||
## Instructions
|
||||
## enigma
|
||||
### Instructions
|
||||
|
||||
Write a function called `Enigma` that receives poiters to functions and move its values around to hide them
|
||||
|
||||
|
@ -7,7 +7,7 @@ This function will put a into c; c into d; d into b and b into a
|
|||
|
||||
This function must have the following signature.
|
||||
|
||||
## Expected function
|
||||
### Expected function
|
||||
|
||||
```go
|
||||
func Enigma(a ***int, b *int, c *******int, d ****int) {
|
||||
|
@ -16,7 +16,7 @@ func Enigma(a ***int, b *int, c *******int, d ****int) {
|
|||
|
||||
```
|
||||
|
||||
## Usage
|
||||
### Usage
|
||||
|
||||
Here is a possible [program](TODO-LINK) to test your function :
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# firstword
|
||||
## firstword
|
||||
|
||||
## Instructions
|
||||
### Instructions
|
||||
|
||||
Write a program that takes a string and displays its first word, followed by a newline.
|
||||
|
||||
|
@ -10,7 +10,7 @@ Write a program that takes a string and displays its first word, followed by a n
|
|||
|
||||
- If the number of parameters is not 1, or if there are no words, simply display a newline.
|
||||
|
||||
## Expected output
|
||||
### Expected output
|
||||
|
||||
```console
|
||||
student@ubuntu:~/piscine/test$ go build
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
# Fix the Main
|
||||
## Fix the Main
|
||||
|
||||
## Instructions
|
||||
### Instructions
|
||||
|
||||
Write and fix the folloing functions.
|
||||
|
||||
## Expected functions
|
||||
### Expected functions
|
||||
|
||||
```go
|
||||
func PutStr(str string) {
|
||||
|
@ -29,7 +29,7 @@ func IsDoorClose(ptrDoor *Door) bool {
|
|||
PutStr("Door is close ?")
|
||||
}
|
||||
```
|
||||
## Usage
|
||||
### Usage
|
||||
|
||||
Here is a possible [program](TODO-LINK) to test your function :
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
# hello
|
||||
## hello
|
||||
|
||||
## Instructions
|
||||
### Instructions
|
||||
|
||||
Write a program that displays "Hello World!".
|
||||
|
||||
## Expected main and function for the program
|
||||
### Expected main and function for the program
|
||||
|
||||
## Expected output
|
||||
### Expected output
|
||||
|
||||
```console
|
||||
student@ubuntu:~/piscine/test$ go build
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# switchcase
|
||||
## switchcase
|
||||
|
||||
## Instructions
|
||||
### 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.
|
||||
|
@ -9,7 +9,7 @@ Write a program that takes two strings and displays, without doubles, the charac
|
|||
|
||||
- If the number of arguments is not 2, the program displays `\n`.
|
||||
|
||||
## Expected output
|
||||
### Expected output
|
||||
|
||||
```console
|
||||
student@ubuntu:~/piscine/test$ go build
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
# join
|
||||
## Instructions
|
||||
## 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
|
||||
|
||||
The function must have the next signature.
|
||||
|
||||
## Expected function
|
||||
### Expected function
|
||||
|
||||
```go
|
||||
|
||||
|
@ -15,7 +15,7 @@ func Join(arstr []string, sep string) string {
|
|||
|
||||
```
|
||||
|
||||
## Usage
|
||||
### Usage
|
||||
|
||||
Here is a possible [program](TODO-LINK) to test your function :
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# lastword
|
||||
## Instructions
|
||||
## lastword
|
||||
### Instructions
|
||||
|
||||
Write a program that takes a string and displays its last word, followed by a
|
||||
newline.
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
# listpushback
|
||||
## listpushback
|
||||
|
||||
## Instructions
|
||||
### Instructions
|
||||
|
||||
Write a function `ListAt` that haves one pointer to the list, `l`, and an `int` as parameters. This function should print a `Node` of the linked list, depending on the number, `nbr`.
|
||||
|
||||
- In case of error it should print `nil`
|
||||
|
||||
## Expected function and structure
|
||||
### Expected function and structure
|
||||
|
||||
```go
|
||||
type Node struct {
|
||||
|
@ -20,7 +20,7 @@ func ListAt(l *Node, nbr int) *Node{
|
|||
}
|
||||
```
|
||||
|
||||
## Usage
|
||||
### Usage
|
||||
|
||||
Here is a possible [program](TODO-LINK) to test your function :
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
# listpushback
|
||||
## listpushback
|
||||
|
||||
## Instructions
|
||||
### Instructions
|
||||
|
||||
Write a function `ListClear` that delets all `nodes` from a linked list, deleting the link between the list.
|
||||
|
||||
- Tip: assign the list's pointer to nil
|
||||
|
||||
## Expected function and structure
|
||||
### Expected function and structure
|
||||
|
||||
```go
|
||||
type Node struct {
|
||||
|
@ -24,7 +24,7 @@ func ListClear(l *List) {
|
|||
}
|
||||
```
|
||||
|
||||
## Usage
|
||||
### Usage
|
||||
|
||||
Here is a possible [program](TODO-LINK) to test your function :
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# listpushback
|
||||
## listpushback
|
||||
|
||||
## Instructions
|
||||
### Instructions
|
||||
|
||||
Write a function `ListFind` that returns the value of the first link that the function in the arguments its equal.
|
||||
|
||||
|
@ -8,7 +8,7 @@ Write a function `ListFind` that returns the value of the first link that the fu
|
|||
|
||||
- Use pointers when ever you can.
|
||||
|
||||
## Expected function and structure
|
||||
### Expected function and structure
|
||||
|
||||
```go
|
||||
type Node struct {
|
||||
|
@ -30,7 +30,7 @@ func ListFind(l *List, comp func(l *List) bool) *interface{} {
|
|||
}
|
||||
```
|
||||
|
||||
## Usage
|
||||
### Usage
|
||||
|
||||
Here is a possible [program](TODO-LINK) to test your function :
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
# listpushback
|
||||
## listpushback
|
||||
|
||||
## Instructions
|
||||
### Instructions
|
||||
|
||||
Write a function `ListForEach` that applies a function given as argument to the information within each of the list's links.
|
||||
|
||||
- The function given as argument must have a pointer as argument: `l *list`
|
||||
|
||||
## Expected function and structure
|
||||
### Expected function and structure
|
||||
|
||||
```go
|
||||
type Node struct {
|
||||
|
@ -23,7 +23,7 @@ func ListForEach(l *list, f func(l *list)) {
|
|||
}
|
||||
```
|
||||
|
||||
## Usage
|
||||
### Usage
|
||||
|
||||
Here is a possible [program](TODO-LINK) to test your function :
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# listpushback
|
||||
## listpushback
|
||||
|
||||
## Instructions
|
||||
### Instructions
|
||||
|
||||
Write a function `ListForEachIf` that applies a function given as argument to the information within some links of the list.
|
||||
|
||||
|
@ -10,7 +10,7 @@ Write a function `ListForEachIf` that applies a function given as argument to th
|
|||
|
||||
- Use pointers wen ever you can.
|
||||
|
||||
## Expected function and structure
|
||||
### Expected function and structure
|
||||
|
||||
```go
|
||||
type node struct {
|
||||
|
@ -32,7 +32,7 @@ func ListForEachIf(l *list, f func(l *list), comp func(l *list) bool) {
|
|||
}
|
||||
```
|
||||
|
||||
## Usage
|
||||
### Usage
|
||||
|
||||
Here is a possible [program](TODO-LINK) to test your function :
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
# listpushback
|
||||
## listpushback
|
||||
|
||||
## Instructions
|
||||
### Instructions
|
||||
|
||||
Write a function `ListLast` that returns the last element of the linked list.
|
||||
|
||||
## Expected function and structure
|
||||
### Expected function and structure
|
||||
|
||||
```go
|
||||
type Node struct {
|
||||
|
@ -21,7 +21,7 @@ func ListLast(l *list) *list {
|
|||
}
|
||||
```
|
||||
|
||||
## Usage
|
||||
### Usage
|
||||
|
||||
Here is a possible [program](TODO-LINK) to test your function :
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# listpushback
|
||||
## listpushback
|
||||
|
||||
## Instructions
|
||||
### Instructions
|
||||
|
||||
Write a function `ListMerge` that places elements of a list `l2` at the end of an other list `l1`.
|
||||
|
||||
|
@ -8,7 +8,7 @@ Write a function `ListMerge` that places elements of a list `l2` at the end of a
|
|||
|
||||
- Use pointers when ever you can.
|
||||
|
||||
## Expected function and structure
|
||||
### Expected function and structure
|
||||
|
||||
```go
|
||||
type NodeL struct {
|
||||
|
@ -26,7 +26,7 @@ func listMerge(l1 *List, l2 *List) {
|
|||
}
|
||||
```
|
||||
|
||||
## Usage
|
||||
### Usage
|
||||
|
||||
Here is a possible [program](TODO-LINK) to test your function :
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
# listpushback
|
||||
## listpushback
|
||||
|
||||
## Instructions
|
||||
### Instructions
|
||||
|
||||
Write a function `ListPushBack` that inserts a new element `Node` at the end of the list, using the structure `List`
|
||||
|
||||
## Expected function and structure
|
||||
### Expected function and structure
|
||||
|
||||
```go
|
||||
type Node struct {
|
||||
|
@ -21,7 +21,7 @@ func ListPushBack(l *List, data interface{}) {
|
|||
}
|
||||
```
|
||||
|
||||
## Usage
|
||||
### Usage
|
||||
|
||||
Here is a possible [program](TODO-LINK) to test your function :
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
# listpushback
|
||||
## listpushback
|
||||
|
||||
## Instructions
|
||||
### Instructions
|
||||
|
||||
Write a function `ListPushBack` that inserts a new element `node` at the beginning of the list using `list`
|
||||
|
||||
## Expected function and structure
|
||||
### Expected function and structure
|
||||
|
||||
```go
|
||||
type Node struct {
|
||||
|
@ -21,7 +21,7 @@ func ListPushFront(l *list, data interface{}) {
|
|||
}
|
||||
```
|
||||
|
||||
## Usage
|
||||
### Usage
|
||||
|
||||
Here is a possible [program](TODO-LINK) to test your function :
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# listpushback
|
||||
## listpushback
|
||||
|
||||
## Instructions
|
||||
### Instructions
|
||||
|
||||
Write a program that creates a new linked list and includes each command-line argument in to the list.
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
# listpushback
|
||||
## listpushback
|
||||
|
||||
## Instructions
|
||||
### Instructions
|
||||
|
||||
Write a function `ListRemoveIf` that removes all elements that are equal to the `data_ref` introduced in the argument of the function.
|
||||
|
||||
- Use pointers wen ever you can.
|
||||
|
||||
|
||||
## Expected function and structure
|
||||
### Expected function and structure
|
||||
|
||||
```go
|
||||
type NodeL struct {
|
||||
|
@ -25,7 +25,7 @@ func ListPushFront(l *List, data interface{}) {
|
|||
}
|
||||
```
|
||||
|
||||
## Usage
|
||||
### Usage
|
||||
|
||||
Here is a possible [program](TODO-LINK) to test your function :
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
# listpushback
|
||||
## listpushback
|
||||
|
||||
## Instructions
|
||||
### Instructions
|
||||
|
||||
Write a function `ListReverse` that reverses the elements order of a given linked list.
|
||||
|
||||
- Use pointers when ever you can
|
||||
|
||||
## Expected function and structure
|
||||
### Expected function and structure
|
||||
|
||||
```go
|
||||
type Node struct {
|
||||
|
@ -23,7 +23,7 @@ func ListReverse(l *list) {
|
|||
}
|
||||
```
|
||||
|
||||
## Usage
|
||||
### Usage
|
||||
|
||||
Here is a possible [program](TODO-LINK) to test your function :
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
# listpushback
|
||||
## listpushback
|
||||
|
||||
## Instructions
|
||||
### Instructions
|
||||
|
||||
Write a function `ListSize` that returns the number of elements in the list.
|
||||
|
||||
## Expected function and structure
|
||||
### Expected function and structure
|
||||
|
||||
```go
|
||||
type Node struct {
|
||||
|
@ -22,7 +22,7 @@ func ListSize(l *List) int {
|
|||
}
|
||||
```
|
||||
|
||||
## Usage
|
||||
### Usage
|
||||
|
||||
Here is a possible [program](TODO-LINK) to test your function :
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# listpushback
|
||||
## listpushback
|
||||
|
||||
## Instructions
|
||||
### Instructions
|
||||
|
||||
Write a function `ListSort` that sorts the linked list by ascending order.
|
||||
|
||||
|
@ -10,7 +10,7 @@ Write a function `ListSort` that sorts the linked list by ascending order.
|
|||
|
||||
- Use pointers when ever you can.
|
||||
|
||||
## Expected function and structure
|
||||
### Expected function and structure
|
||||
|
||||
```go
|
||||
type Nodee struct {
|
||||
|
@ -23,7 +23,7 @@ func ListSort(l *NodeL) *NodeL {
|
|||
}
|
||||
```
|
||||
|
||||
## Usage
|
||||
### Usage
|
||||
|
||||
Here is a possible [program](TODO-LINK) to test your function :
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
# max
|
||||
## Instructions
|
||||
## max
|
||||
### Instructions
|
||||
|
||||
Write a function, Max, that returns the maximum value in a slice of integers
|
||||
|
||||
The function must have the next signature.
|
||||
|
||||
## Expected function
|
||||
### Expected function
|
||||
|
||||
```go
|
||||
|
||||
|
@ -15,7 +15,7 @@ func Max(arr []int) int {
|
|||
|
||||
```
|
||||
|
||||
## Usage
|
||||
### Usage
|
||||
|
||||
Here is a possible [program](TODO-LINK) to test your function :
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# onlya
|
||||
## onlya
|
||||
|
||||
## Instructions
|
||||
### Instructions
|
||||
|
||||
Write a program that displays a 'a' character on the standard output.
|
|
@ -1,4 +1,4 @@
|
|||
# displayalpham
|
||||
## Instructions
|
||||
## displayalpham
|
||||
### Instructions
|
||||
|
||||
Write a program that displays a 'z' character on the standard output.
|
|
@ -1,9 +1,9 @@
|
|||
# pilot
|
||||
## Instructions
|
||||
## pilot
|
||||
### Instructions
|
||||
|
||||
Write a go file so that the following program compile
|
||||
|
||||
## Usage
|
||||
### Usage
|
||||
|
||||
```go
|
||||
package main
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Point
|
||||
|
||||
## Instructions
|
||||
### Instructions
|
||||
|
||||
Create a `.go` file and copy the code below into our file
|
||||
|
||||
|
@ -24,7 +24,7 @@ func main() {
|
|||
}
|
||||
```
|
||||
|
||||
## Expected output
|
||||
### Expected output
|
||||
|
||||
```console
|
||||
student@ubuntu:~/piscine/test$ go build
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Rectangle
|
||||
## Rectangle
|
||||
|
||||
## Instructions
|
||||
### Instructions
|
||||
|
||||
Consider that a point is defined by its coordinates and that a rectangle
|
||||
is defined by the points of the upper left and lower right corners.
|
||||
|
@ -17,7 +17,7 @@ is defined by the points of the upper left and lower right corners.
|
|||
|
||||
- And calculates and prints the area of that rectangle you define.
|
||||
|
||||
## Expected main and function for the program
|
||||
### Expected main and function for the program
|
||||
|
||||
```go
|
||||
func defineRectangle(ptr *point, n int) *rectangle {
|
||||
|
@ -46,7 +46,7 @@ func main() {
|
|||
```
|
||||
|
||||
|
||||
## Expected output
|
||||
### Expected output
|
||||
|
||||
```console
|
||||
student@ubuntu:~/piscine/test$ go build
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# repeatalpha
|
||||
## Instructions
|
||||
## 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,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# reversebits
|
||||
## Instructions
|
||||
## reversebits
|
||||
### Instructions
|
||||
|
||||
Write a function that takes a byte, reverses it, bit by bit (like the
|
||||
example) and returns the result.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# rot13
|
||||
## rot13
|
||||
|
||||
## Instructions
|
||||
### Instructions
|
||||
|
||||
Write a program that takes a string and displays it, replacing each of its
|
||||
letters by the letter 13 spaces ahead in alphabetical order.
|
||||
|
@ -11,7 +11,7 @@ letters by the letter 13 spaces ahead in alphabetical order.
|
|||
|
||||
- If the number of arguments is not 1, the program displays a newline.
|
||||
|
||||
## Expected output
|
||||
### Expected output
|
||||
|
||||
```console
|
||||
student@ubuntu:~/piscine/test$ go build
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
# ROT 14
|
||||
## ROT 14
|
||||
|
||||
## Instructions
|
||||
### Instructions
|
||||
|
||||
Write a function `rot14` that returns the string within the parameter but transformed into a rot14 string.
|
||||
|
||||
- If you not certain what we are talking about, there is a rot13 already.
|
||||
|
||||
## Expected function
|
||||
### Expected function
|
||||
|
||||
```go
|
||||
func rot14(str string) string {
|
||||
|
||||
}
|
||||
```
|
||||
## Usage
|
||||
### Usage
|
||||
|
||||
Here is a possible [program](TODO-LINK) to test your function :
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# searchreplace
|
||||
## searchreplace
|
||||
|
||||
## Instructions
|
||||
### 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).
|
||||
|
||||
|
@ -8,7 +8,7 @@ Write a program that takes 3 arguments, the first arguments is a string in whic
|
|||
|
||||
- If the second argument is not contained in the first one (the string) then the program simply rewrites the string followed by a newline.
|
||||
|
||||
## Expected output
|
||||
### Expected output
|
||||
|
||||
```console
|
||||
student@ubuntu:~/piscine/test$ go build
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# listpushback
|
||||
## listpushback
|
||||
|
||||
## Instructions
|
||||
### Instructions
|
||||
|
||||
Write a function `SortedListMerge` that mereges two lists, `l1` and `l2`, but you have to join them in ascending order.
|
||||
|
||||
|
@ -8,7 +8,7 @@ Write a function `SortedListMerge` that mereges two lists, `l1` and `l2`, but yo
|
|||
|
||||
- Use pointers when ever you can.
|
||||
|
||||
## Expected function and structure
|
||||
### Expected function and structure
|
||||
|
||||
```go
|
||||
type Nodee struct {
|
||||
|
@ -21,7 +21,7 @@ func SortedListMerge(l1 *Nodee, l2 *Nodee) *Nodee {
|
|||
}
|
||||
```
|
||||
|
||||
## Usage
|
||||
### Usage
|
||||
|
||||
Here is a possible [program](TODO-LINK) to test your function :
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# listpushback
|
||||
## listpushback
|
||||
|
||||
## Instructions
|
||||
### Instructions
|
||||
|
||||
Write a function `SortListInsert` that inserts `Data_ref` in the linked list, but it as to remain sorted in ascending order.
|
||||
|
||||
|
@ -8,7 +8,7 @@ Write a function `SortListInsert` that inserts `Data_ref` in the linked list, bu
|
|||
|
||||
- Use pointers when ever you can.
|
||||
|
||||
## Expected function and structure
|
||||
### Expected function and structure
|
||||
|
||||
```go
|
||||
type Nodee struct {
|
||||
|
@ -21,7 +21,7 @@ func SortListInsert(l *Nodee, Data_ref int) *Nodee{
|
|||
}
|
||||
```
|
||||
|
||||
## Usage
|
||||
### Usage
|
||||
|
||||
Here is a possible [program](TODO-LINK) to test your function :
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
# strlen
|
||||
## strlen
|
||||
|
||||
## Instructions
|
||||
### Instructions
|
||||
|
||||
Write a function that returns the length of a string.
|
||||
|
||||
- `len` is forbidden
|
||||
|
||||
## Expected function and structure
|
||||
### Expected function and structure
|
||||
|
||||
```go
|
||||
func Strlen(str string) int {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# swapbits
|
||||
## Instructions
|
||||
## swapbits
|
||||
### Instructions
|
||||
|
||||
Write a function that takes a byte, swaps its halves (like the example) and
|
||||
returns the result.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# switchcase
|
||||
## switchcase
|
||||
|
||||
## Instructions
|
||||
### Instructions
|
||||
|
||||
Write a program that takes a string and reverses the case of all its letters.
|
||||
|
||||
|
@ -10,7 +10,7 @@ Write a program that takes a string and reverses the case of all its letters.
|
|||
|
||||
- If the number of arguments is not 1, the program displays '\n'.
|
||||
|
||||
## Expected output
|
||||
### Expected output
|
||||
|
||||
```console
|
||||
student@ubuntu:~/piscine/test$ go build
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# union
|
||||
## Instructions
|
||||
## union
|
||||
### Instructions
|
||||
|
||||
Write a program that takes two strings and displays, without doubles, the
|
||||
characters that appear in either one of the strings.
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
# join
|
||||
## Instructions
|
||||
## join
|
||||
### Instructions
|
||||
|
||||
Write a function, Unmatch, that returns the element of the slice (arr) that does not have a correspondent pair.
|
||||
|
||||
The function must have the next signature.
|
||||
|
||||
## Expected function
|
||||
### Expected function
|
||||
|
||||
```go
|
||||
|
||||
|
@ -15,7 +15,7 @@ func Unmatch(arr []int) int {
|
|||
|
||||
```
|
||||
|
||||
## Usage
|
||||
### Usage
|
||||
|
||||
Here is a possible [program](TODO-LINK) to test your function :
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# switchcase
|
||||
## switchcase
|
||||
|
||||
## Instructions
|
||||
### 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.
|
||||
|
@ -9,7 +9,7 @@ Write a program that takes two strings and checks whether it's possible to write
|
|||
|
||||
- If the number of arguments is not 2, the program displays `\n`.
|
||||
|
||||
## Expected output
|
||||
### Expected output
|
||||
|
||||
```console
|
||||
student@ubuntu:~/piscine/test$ go build
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# ztail
|
||||
## Instructions
|
||||
## 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.
|
||||
|
||||
|
|
Loading…
Reference in New Issue