From e65cf850d34286684a981236160cfca6acca1803 Mon Sep 17 00:00:00 2001 From: lee Date: Fri, 3 May 2019 09:57:24 +0100 Subject: [PATCH 1/7] readmes for the exams, fprime and sortList --- subjects/fprime.md | 30 ++++++++++++++++++++++++++++++ subjects/sortList.md | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 subjects/fprime.md create mode 100644 subjects/sortList.md diff --git a/subjects/fprime.md b/subjects/fprime.md new file mode 100644 index 000000000..efecbf9ad --- /dev/null +++ b/subjects/fprime.md @@ -0,0 +1,30 @@ +## fprime + +### Instructions + +Write a program that takes a positive `int` and displays its prime factors on the standard output, followed by a newline. + +- 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. + +- The input, when there's one, will be valid. + +Example of output : + +```console +student@ubuntu:~/piscine/test$ go build +student@ubuntu:~/piscine/test$ ./test 225225 +3*3*5*5*7*11*13 +student@ubuntu:~/piscine/test$ ./test 8333325 +3*3*5*5*7*11*13*37 +student@ubuntu:~/piscine/test$ ./test 9539 +9539 +student@ubuntu:~/piscine/test$ ./test 804577 +804577 +student@ubuntu:~/piscine/test$ ./test 42 +2*3*7 +student@ubuntu:~/piscine/test$ ./test + +student@ubuntu:~/piscine/test$ +``` \ No newline at end of file diff --git a/subjects/sortList.md b/subjects/sortList.md new file mode 100644 index 000000000..58d15f797 --- /dev/null +++ b/subjects/sortList.md @@ -0,0 +1,32 @@ +## sortList + +### Instructions + +Write the following function: + +```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. + +- Duplications must remain. + +- Input will always be consistent. + +- You must use the `type NodeList`. + +- Functions passed as cmp will always return a value different from 0 if a and b are in the right order, 0 otherwise. + +- For example, the following function used as cmp will sort the list in ascending order : + +```go +func ascending(a, b int) bool{ + if a <= b { + return true + } else { + return false + } +} +``` \ No newline at end of file From 9a8fefe7996f5361e5101f899453f253d43feb1b Mon Sep 17 00:00:00 2001 From: lee Date: Fri, 3 May 2019 12:34:25 +0100 Subject: [PATCH 2/7] revWstr readme for the exams --- subjects/revWstr.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 subjects/revWstr.md diff --git a/subjects/revWstr.md b/subjects/revWstr.md new file mode 100644 index 000000000..808f8b585 --- /dev/null +++ b/subjects/revWstr.md @@ -0,0 +1,26 @@ +## revWstr + +### Instructions + +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. + +- 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). + +Example of output : + +```console +student@ubuntu:~/piscine/test$ go build +student@ubuntu:~/piscine/test$ ./test "the time of contempt precedes that of indifference" +indifference of that precedes contempt of time the +student@ubuntu:~/piscine/test$ ./test "abcdefghijklm" +abcdefghijklm +student@ubuntu:~/piscine/test$ ./test "he stared at the mountain" +mountain the at stared he +student@ubuntu:~/piscine/test$ ./test + +student@ubuntu:~/piscine/test$ +``` \ No newline at end of file From b3f978f0214e087a1e5e599a1df521532d4ddadb Mon Sep 17 00:00:00 2001 From: lee Date: Fri, 3 May 2019 12:36:42 +0100 Subject: [PATCH 3/7] revwstr exr for the exams --- subjects/{revWstr.md => revwstr.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename subjects/{revWstr.md => revwstr.md} (100%) diff --git a/subjects/revWstr.md b/subjects/revwstr.md similarity index 100% rename from subjects/revWstr.md rename to subjects/revwstr.md From 9ab6d93d314be7811b7328aaeb0953035e75b355 Mon Sep 17 00:00:00 2001 From: lee Date: Fri, 3 May 2019 12:39:55 +0100 Subject: [PATCH 4/7] revwstr exr for the exams --- subjects/revWstr.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 subjects/revWstr.md diff --git a/subjects/revWstr.md b/subjects/revWstr.md new file mode 100644 index 000000000..61ef16101 --- /dev/null +++ b/subjects/revWstr.md @@ -0,0 +1,26 @@ +## revwstr + +### Instructions + +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. + +- 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). + +Example of output : + +```console +student@ubuntu:~/piscine/test$ go build +student@ubuntu:~/piscine/test$ ./test "the time of contempt precedes that of indifference" +indifference of that precedes contempt of time the +student@ubuntu:~/piscine/test$ ./test "abcdefghijklm" +abcdefghijklm +student@ubuntu:~/piscine/test$ ./test "he stared at the mountain" +mountain the at stared he +student@ubuntu:~/piscine/test$ ./test + +student@ubuntu:~/piscine/test$ +``` \ No newline at end of file From 98c2112a19bfd550b9956f414128f9b414177cb1 Mon Sep 17 00:00:00 2001 From: lee Date: Fri, 3 May 2019 15:44:21 +0100 Subject: [PATCH 5/7] correction of the lenguage --- subjects/{fprime.md => fprime.en.md} | 0 subjects/{revwstr.md => revwstr.en.md} | 0 subjects/{sortList.md => sortList.en.md} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename subjects/{fprime.md => fprime.en.md} (100%) rename subjects/{revwstr.md => revwstr.en.md} (100%) rename subjects/{sortList.md => sortList.en.md} (100%) diff --git a/subjects/fprime.md b/subjects/fprime.en.md similarity index 100% rename from subjects/fprime.md rename to subjects/fprime.en.md diff --git a/subjects/revwstr.md b/subjects/revwstr.en.md similarity index 100% rename from subjects/revwstr.md rename to subjects/revwstr.en.md diff --git a/subjects/sortList.md b/subjects/sortList.en.md similarity index 100% rename from subjects/sortList.md rename to subjects/sortList.en.md From b1edc04747ee1c6e67421ec103e1a4f90978ae10 Mon Sep 17 00:00:00 2001 From: lee Date: Fri, 3 May 2019 15:47:07 +0100 Subject: [PATCH 6/7] deletion of duplicats --- subjects/revWstr.md | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 subjects/revWstr.md diff --git a/subjects/revWstr.md b/subjects/revWstr.md deleted file mode 100644 index 61ef16101..000000000 --- a/subjects/revWstr.md +++ /dev/null @@ -1,26 +0,0 @@ -## revwstr - -### Instructions - -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. - -- 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). - -Example of output : - -```console -student@ubuntu:~/piscine/test$ go build -student@ubuntu:~/piscine/test$ ./test "the time of contempt precedes that of indifference" -indifference of that precedes contempt of time the -student@ubuntu:~/piscine/test$ ./test "abcdefghijklm" -abcdefghijklm -student@ubuntu:~/piscine/test$ ./test "he stared at the mountain" -mountain the at stared he -student@ubuntu:~/piscine/test$ ./test - -student@ubuntu:~/piscine/test$ -``` \ No newline at end of file From 973c18f73da027bb5b90d180e7a3a75047c6929a Mon Sep 17 00:00:00 2001 From: Christopher Fremond Date: Fri, 3 May 2019 18:23:44 +0100 Subject: [PATCH 7/7] formatting --- subjects/fprime.en.md | 6 +++--- subjects/revwstr.en.md | 8 ++++---- subjects/sortList.en.md | 31 ++++++++++++++++++------------- 3 files changed, 25 insertions(+), 20 deletions(-) diff --git a/subjects/fprime.en.md b/subjects/fprime.en.md index efecbf9ad..3335cdd2e 100644 --- a/subjects/fprime.en.md +++ b/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$ -``` \ No newline at end of file +``` diff --git a/subjects/revwstr.en.md b/subjects/revwstr.en.md index 808f8b585..a59eb631b 100644 --- a/subjects/revwstr.en.md +++ b/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$ -``` \ No newline at end of file +``` diff --git a/subjects/sortList.en.md b/subjects/sortList.en.md index 58d15f797..16fe29c56 100644 --- a/subjects/sortList.en.md +++ b/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 } } -``` \ No newline at end of file +```