|
|
|
@ -2,11 +2,11 @@
|
|
|
|
|
|
|
|
|
|
### Introduction |
|
|
|
|
|
|
|
|
|
- Welcome back. Congratulations on your admission. |
|
|
|
|
- Welcome back. Congratulations on your admission. |
|
|
|
|
|
|
|
|
|
This subject is a selection of the best exercises of the piscine-go. |
|
|
|
|
This selection was made to get back smoothly to programming in go after the pause period. |
|
|
|
|
All the exercises have to be done and they must all pass each and every tests. |
|
|
|
|
All the exercises have to be done and they must all pass each and every tests. |
|
|
|
|
|
|
|
|
|
The goal of this project is to realize what you know and what you still need to practice on. |
|
|
|
|
We strongly advise you to resist the temptation of looking at your old repository. |
|
|
|
@ -15,13 +15,15 @@ To really learn programming, you must practice programming, so copy and pasting
|
|
|
|
|
|
|
|
|
|
One more detail. This time the project will be corrected by auditors. The auditors will be others students and you will be an auditor as well. |
|
|
|
|
|
|
|
|
|
We advise you to create your own tests for yourself and for when you will correct your students. |
|
|
|
|
We advise you to create your own tests for yourself and for when you will correct your students. |
|
|
|
|
|
|
|
|
|
--- |
|
|
|
|
|
|
|
|
|
## atoi |
|
|
|
|
|
|
|
|
|
### Allowed functions |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- `"--cast"` |
|
|
|
|
|
|
|
|
|
### Instructions |
|
|
|
|
|
|
|
|
@ -99,8 +101,14 @@ student@ubuntu:~/[[ROOT]]/test$ ./test
|
|
|
|
|
student@ubuntu:~/[[ROOT]]/test$ |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
--- |
|
|
|
|
|
|
|
|
|
## recursivepower |
|
|
|
|
|
|
|
|
|
### Allowed functions |
|
|
|
|
|
|
|
|
|
- `"--cast"` |
|
|
|
|
|
|
|
|
|
### Instructions |
|
|
|
|
|
|
|
|
|
Write an **recursive** function that returns the power of the `int` passed as parameter. |
|
|
|
@ -145,8 +153,15 @@ student@ubuntu:~/[[ROOT]]/test$ ./test
|
|
|
|
|
student@ubuntu:~/[[ROOT]]/test$ |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
--- |
|
|
|
|
|
|
|
|
|
## printcombn |
|
|
|
|
|
|
|
|
|
### Allowed functions |
|
|
|
|
|
|
|
|
|
- `"--cast"` |
|
|
|
|
- `"github.com/01-edu/z01.PrintRune"` |
|
|
|
|
|
|
|
|
|
### Instructions |
|
|
|
|
|
|
|
|
|
- Write a function that prints all possible combinations of **n** different digits in ascending order. |
|
|
|
@ -194,8 +209,15 @@ student@ubuntu:~/[[ROOT]]/test$ ./test
|
|
|
|
|
student@ubuntu:~/[[ROOT]]/test$ |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
--- |
|
|
|
|
|
|
|
|
|
## printnbrbase |
|
|
|
|
|
|
|
|
|
### Allowed functions |
|
|
|
|
|
|
|
|
|
- `"--cast"` |
|
|
|
|
- `"github.com/01-edu/z01.PrintRune"` |
|
|
|
|
|
|
|
|
|
### Instructions |
|
|
|
|
|
|
|
|
|
Write a function that prints an `int` in a `string` base passed in parameters. |
|
|
|
@ -258,8 +280,17 @@ NV
|
|
|
|
|
student@ubuntu:~/[[ROOT]]/test$ |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
--- |
|
|
|
|
|
|
|
|
|
## doop |
|
|
|
|
|
|
|
|
|
### Allowed functions |
|
|
|
|
|
|
|
|
|
- `"--cast"` |
|
|
|
|
- `"github.com/01-edu/z01.PrintRune"` |
|
|
|
|
- `"os.*"` |
|
|
|
|
- `".."` |
|
|
|
|
|
|
|
|
|
### Instructions |
|
|
|
|
|
|
|
|
|
Write a program that is called `doop`. |
|
|
|
@ -308,8 +339,15 @@ student@ubuntu:~/[[ROOT]]/test$ ./doop 1 "*" -1
|
|
|
|
|
student@ubuntu:~/[[ROOT]]/test$ |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
--- |
|
|
|
|
|
|
|
|
|
## atoibase |
|
|
|
|
|
|
|
|
|
### Allowed functions |
|
|
|
|
|
|
|
|
|
- `"--cast"` |
|
|
|
|
- `"make"` |
|
|
|
|
|
|
|
|
|
### Instructions |
|
|
|
|
|
|
|
|
|
Write a function that takes a `string` number and its `string` base in parameters and returns its conversion as an `int`. |
|
|
|
@ -367,8 +405,15 @@ student@ubuntu:~/[[ROOT]]/test$ ./test
|
|
|
|
|
0 |
|
|
|
|
student@ubuntu:~/[[ROOT]]/test$ |
|
|
|
|
``` |
|
|
|
|
--- |
|
|
|
|
|
|
|
|
|
## splitwhitespaces |
|
|
|
|
|
|
|
|
|
### Allowed functions |
|
|
|
|
|
|
|
|
|
- `"--cast"` |
|
|
|
|
- `"make"` |
|
|
|
|
|
|
|
|
|
### Instructions |
|
|
|
|
|
|
|
|
|
Write a function that separates the words of a `string` and puts them in a `string` array. |
|
|
|
@ -410,8 +455,15 @@ student@ubuntu:~/[[ROOT]]/test$ ./test
|
|
|
|
|
student@ubuntu:~/[[ROOT]]/test$ |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
--- |
|
|
|
|
|
|
|
|
|
## split |
|
|
|
|
|
|
|
|
|
### Allowed functions |
|
|
|
|
|
|
|
|
|
- `"--cast"` |
|
|
|
|
- `"make"` |
|
|
|
|
|
|
|
|
|
### Instructions |
|
|
|
|
|
|
|
|
|
Write a function that separates the words of a `string` and puts them in a `string` array. |
|
|
|
@ -453,8 +505,15 @@ student@ubuntu:~/[[ROOT]]/test$ ./test
|
|
|
|
|
student@ubuntu:~/[[ROOT]]/test$ |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
--- |
|
|
|
|
|
|
|
|
|
## convertbase |
|
|
|
|
|
|
|
|
|
### Allowed functions |
|
|
|
|
|
|
|
|
|
- `"--cast"` |
|
|
|
|
- `".."` |
|
|
|
|
|
|
|
|
|
### Instructions |
|
|
|
|
|
|
|
|
|
Write a function that returns the conversion of a `string` number from one `string` baseFrom to one `string` baseTo. |
|
|
|
@ -498,8 +557,17 @@ student@ubuntu:~/[[ROOT]]/test$ ./test
|
|
|
|
|
student@ubuntu:~/[[ROOT]]/test$ |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
--- |
|
|
|
|
|
|
|
|
|
## rotatevowels |
|
|
|
|
|
|
|
|
|
### Allowed functions |
|
|
|
|
|
|
|
|
|
- `"os.*"` |
|
|
|
|
- `"--cast"` |
|
|
|
|
- `"github.com/01-edu/z01.PrintRune"` |
|
|
|
|
- `"make"` |
|
|
|
|
|
|
|
|
|
### Instructions |
|
|
|
|
|
|
|
|
|
Write a **program** that checks the arguments for vowels. |
|
|
|
@ -527,8 +595,15 @@ student@ubuntu:~/[[ROOT]]/test$ ./rotatevowels
|
|
|
|
|
student@ubuntu:~/[[ROOT]]/test$ |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
--- |
|
|
|
|
|
|
|
|
|
## advancedsortwordarr |
|
|
|
|
|
|
|
|
|
### Allowed functions |
|
|
|
|
|
|
|
|
|
- `".."` |
|
|
|
|
- `"len"` |
|
|
|
|
|
|
|
|
|
### Instructions |
|
|
|
|
|
|
|
|
|
Write a function `AdvancedSortWordArr` that sorts a `string` array, based on the function `f` passed in parameter. |
|
|
|
@ -571,8 +646,19 @@ student@ubuntu:~/[[ROOT]]/test$ ./test
|
|
|
|
|
student@ubuntu:~/[[ROOT]]/test$ |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
--- |
|
|
|
|
|
|
|
|
|
## cat |
|
|
|
|
|
|
|
|
|
### Allowed functions |
|
|
|
|
|
|
|
|
|
- `"os.*"` |
|
|
|
|
- `"--cast"` |
|
|
|
|
- `"github.com/01-edu/z01.PrintRune"` |
|
|
|
|
- `".."` |
|
|
|
|
- `"ioutil.*"` |
|
|
|
|
- `"io.*"` |
|
|
|
|
|
|
|
|
|
### Instructions |
|
|
|
|
|
|
|
|
|
Write a program that has the same behaviour as the system's `cat` command-line. |
|
|
|
@ -611,8 +697,19 @@ student@ubuntu:~/[[ROOT]]/cat$ ./cat quest8.txt quest8T.txt
|
|
|
|
|
student@ubuntu:~/[[ROOT]]/cat$ |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
--- |
|
|
|
|
|
|
|
|
|
## ztail |
|
|
|
|
|
|
|
|
|
### Allowed functions |
|
|
|
|
|
|
|
|
|
- `"os.*"` |
|
|
|
|
- `"--cast"` |
|
|
|
|
- `"github.com/01-edu/z01.PrintRune"` |
|
|
|
|
- `"append"` |
|
|
|
|
- `"fmt.Printf"` |
|
|
|
|
- `".."` |
|
|
|
|
|
|
|
|
|
### Instructions |
|
|
|
|
|
|
|
|
|
Write a program called `ztail` that has the same behaviour as the system command `tail`, but which takes at least one file as argument. |
|
|
|
@ -631,8 +728,14 @@ Write a program called `ztail` that has the same behaviour as the system command
|
|
|
|
|
|
|
|
|
|
This program is gonna be tested against `tail`, be sure to check all the different error messages with different permutations of the arguments. |
|
|
|
|
|
|
|
|
|
--- |
|
|
|
|
|
|
|
|
|
## activebits |
|
|
|
|
|
|
|
|
|
### Allowed functions |
|
|
|
|
|
|
|
|
|
- `"--cast"` |
|
|
|
|
|
|
|
|
|
### Instructions |
|
|
|
|
|
|
|
|
|
Write a function, `ActiveBits`, that returns the number of active `bits` (bits with the value 1) in the binary representation of an integer number. |
|
|
|
@ -672,8 +775,14 @@ student@ubuntu:~/[[ROOT]]/test$ ./test
|
|
|
|
|
student@ubuntu:~/[[ROOT]]/test$ |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
--- |
|
|
|
|
|
|
|
|
|
## sortlistinsert |
|
|
|
|
|
|
|
|
|
### Allowed functions |
|
|
|
|
|
|
|
|
|
- `"--no-array"` |
|
|
|
|
|
|
|
|
|
### Instructions |
|
|
|
|
|
|
|
|
|
Write a function `SortListInsert` that inserts `data_ref` in the linked list `l` while keeping the list sorted in ascending order. |
|
|
|
@ -750,8 +859,14 @@ student@ubuntu:~/[[ROOT]]/test$ ./test
|
|
|
|
|
student@ubuntu:~/[[ROOT]]/test$ |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
--- |
|
|
|
|
|
|
|
|
|
## sortedlistmerge |
|
|
|
|
|
|
|
|
|
### Allowed functions |
|
|
|
|
|
|
|
|
|
- `"--no-array"` |
|
|
|
|
|
|
|
|
|
### Instructions |
|
|
|
|
|
|
|
|
|
Write a function `SortedListMerge` that merges two lists `n1` and `n2` in ascending order. |
|
|
|
@ -826,8 +941,14 @@ student@ubuntu:~/[[ROOT]]/test$ ./test
|
|
|
|
|
student@ubuntu:~/[[ROOT]]/test$ |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
--- |
|
|
|
|
|
|
|
|
|
## listremoveif |
|
|
|
|
|
|
|
|
|
### Allowed functions |
|
|
|
|
|
|
|
|
|
- `"--no-array"` |
|
|
|
|
|
|
|
|
|
### Instructions |
|
|
|
|
|
|
|
|
|
Write a function `ListRemoveIf` that removes all elements that are equal to the `data_ref` in the argument of the function. |
|
|
|
@ -922,6 +1043,8 @@ Hello -> There -> How -> are -> you -> <nil>
|
|
|
|
|
student@ubuntu:~/[[ROOT]]/test$ |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
--- |
|
|
|
|
|
|
|
|
|
## btreetransplant |
|
|
|
|
|
|
|
|
|
### Instructions |
|
|
|
@ -972,6 +1095,8 @@ student@ubuntu:~/[[ROOT]]/test$ ./test
|
|
|
|
|
student@ubuntu:~/[[ROOT]]/test$ |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
--- |
|
|
|
|
|
|
|
|
|
## btreeapplybylevel |
|
|
|
|
|
|
|
|
|
### Instructions |
|
|
|
@ -1019,6 +1144,8 @@ student@ubuntu:~/[[ROOT]]/test$ ./test
|
|
|
|
|
student@ubuntu:~/[[ROOT]]/test$ |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
--- |
|
|
|
|
|
|
|
|
|
## btreedeletenode |
|
|
|
|
|
|
|
|
|
### Instructions |
|
|
|
|