From 1477f9303ec39160fb15ea0dc2b00bfda0f52394 Mon Sep 17 00:00:00 2001 From: Clement Denis Date: Wed, 24 Apr 2019 18:20:39 +0100 Subject: [PATCH] rename previous and cleanup doubles --- subjects/{abort.md => abort.en.md} | 0 subjects/{activebits.md => activebits.en.md} | 0 .../{alphamirror.md => alphamirror.en.md} | 0 subjects/{bool.md => bool.en.md} | 0 ...pplybylevel.md => btreeapplybylevel.en.md} | 0 ...reedeletenode.md => btreedeletenode.en.md} | 0 .../{btreeisbinary.md => btreeisbinary.en.md} | 0 ...reelevelcount.md => btreelevelcount.en.md} | 0 subjects/{btreemax.md => btreemax.en.md} | 0 subjects/{btreemin.md => btreemin.en.md} | 0 ...reetransplant.md => btreetransplant.en.md} | 0 subjects/{cat.md => cat.en.md} | 0 ...atzcountdown.md => collatzcountdown.en.md} | 0 subjects/{comcheck.md => comcheck.en.md} | 0 subjects/{compact.md => compact.en.md} | 0 subjects/{countdown.md => countdown.en.md} | 0 subjects/{createelem.md => createelem.en.md} | 0 .../{dispfirstpar.md => dispfirstpar.en.md} | 0 .../{displastpar.md => displastpar.en.md} | 0 subjects/{displaya.md => displaya.en.md} | 0 .../{displayalpham.md => displayalpham.en.md} | 0 .../{displayalrevm.md => displayalrevm.en.md} | 0 .../{displayfile.md => displayfile.en.md} | 0 subjects/{displayz.md => displayz.en.md} | 0 subjects/{enigma.md => enigma.en.md} | 0 subjects/{firstword.md => firstword.en.md} | 0 subjects/{fixthemain.md => fixthemain.en.md} | 0 subjects/{hello.md => hello.en.md} | 0 subjects/{inter.md => inter.en.md} | 0 subjects/join.md | 43 ------- subjects/{lastword.md => lastword.en.md} | 0 subjects/listat.md | 60 ---------- subjects/listclear.md | 77 ------------- subjects/listfind.md | 64 ----------- subjects/listforeach.md | 65 ----------- subjects/listforeachif.md | 105 ------------------ subjects/listlast.md | 58 ---------- subjects/listmerge.md | 78 ------------- subjects/listpushback.md | 60 ---------- subjects/listpushfront.md | 60 ---------- .../{listpushpara.md => listpushpara.en.md} | 0 subjects/listremoveif.md | 99 ----------------- subjects/listreverse.md | 65 ----------- subjects/listsize.md | 56 ---------- subjects/listsort.md | 89 --------------- subjects/{max.md => max.en.md} | 0 subjects/{onlya.md => onlya.en.md} | 0 subjects/{onlyz.md => onlyz.en.md} | 0 subjects/{pilot.md => pilot.en.md} | 0 subjects/{point.md => point.en.md} | 0 subjects/{printbits.md => printbits.en.md} | 0 subjects/{rectangle.md => rectangle.en.md} | 0 .../{repeatalpha.md => repeatalpha.en.md} | 0 .../{reversebits.md => reversebits.en.md} | 0 subjects/{rot13.md => rot13.en.md} | 0 subjects/{rot14.md => rot14.en.md} | 0 .../{searchreplace.md => searchreplace.en.md} | 0 subjects/sortedlistmerge.md | 71 ------------ subjects/sortlistinsert.md | 87 --------------- subjects/strlen.md | 24 ---- subjects/{swapbits.md => swapbits.en.md} | 0 subjects/{switchcase.md => switchcase.en.md} | 0 subjects/{union.md => union.en.md} | 0 subjects/{unmatch.md => unmatch.en.md} | 0 subjects/{wdmatch.md => wdmatch.en.md} | 0 subjects/{ztail.md => ztail.en.md} | 0 66 files changed, 1161 deletions(-) rename subjects/{abort.md => abort.en.md} (100%) rename subjects/{activebits.md => activebits.en.md} (100%) rename subjects/{alphamirror.md => alphamirror.en.md} (100%) rename subjects/{bool.md => bool.en.md} (100%) rename subjects/{btreeapplybylevel.md => btreeapplybylevel.en.md} (100%) rename subjects/{btreedeletenode.md => btreedeletenode.en.md} (100%) rename subjects/{btreeisbinary.md => btreeisbinary.en.md} (100%) rename subjects/{btreelevelcount.md => btreelevelcount.en.md} (100%) rename subjects/{btreemax.md => btreemax.en.md} (100%) rename subjects/{btreemin.md => btreemin.en.md} (100%) rename subjects/{btreetransplant.md => btreetransplant.en.md} (100%) rename subjects/{cat.md => cat.en.md} (100%) rename subjects/{collatzcountdown.md => collatzcountdown.en.md} (100%) rename subjects/{comcheck.md => comcheck.en.md} (100%) rename subjects/{compact.md => compact.en.md} (100%) rename subjects/{countdown.md => countdown.en.md} (100%) rename subjects/{createelem.md => createelem.en.md} (100%) rename subjects/{dispfirstpar.md => dispfirstpar.en.md} (100%) rename subjects/{displastpar.md => displastpar.en.md} (100%) rename subjects/{displaya.md => displaya.en.md} (100%) rename subjects/{displayalpham.md => displayalpham.en.md} (100%) rename subjects/{displayalrevm.md => displayalrevm.en.md} (100%) rename subjects/{displayfile.md => displayfile.en.md} (100%) rename subjects/{displayz.md => displayz.en.md} (100%) rename subjects/{enigma.md => enigma.en.md} (100%) rename subjects/{firstword.md => firstword.en.md} (100%) rename subjects/{fixthemain.md => fixthemain.en.md} (100%) rename subjects/{hello.md => hello.en.md} (100%) rename subjects/{inter.md => inter.en.md} (100%) delete mode 100644 subjects/join.md rename subjects/{lastword.md => lastword.en.md} (100%) delete mode 100644 subjects/listat.md delete mode 100644 subjects/listclear.md delete mode 100644 subjects/listfind.md delete mode 100644 subjects/listforeach.md delete mode 100644 subjects/listforeachif.md delete mode 100644 subjects/listlast.md delete mode 100644 subjects/listmerge.md delete mode 100644 subjects/listpushback.md delete mode 100644 subjects/listpushfront.md rename subjects/{listpushpara.md => listpushpara.en.md} (100%) delete mode 100644 subjects/listremoveif.md delete mode 100644 subjects/listreverse.md delete mode 100644 subjects/listsize.md delete mode 100644 subjects/listsort.md rename subjects/{max.md => max.en.md} (100%) rename subjects/{onlya.md => onlya.en.md} (100%) rename subjects/{onlyz.md => onlyz.en.md} (100%) rename subjects/{pilot.md => pilot.en.md} (100%) rename subjects/{point.md => point.en.md} (100%) rename subjects/{printbits.md => printbits.en.md} (100%) rename subjects/{rectangle.md => rectangle.en.md} (100%) rename subjects/{repeatalpha.md => repeatalpha.en.md} (100%) rename subjects/{reversebits.md => reversebits.en.md} (100%) rename subjects/{rot13.md => rot13.en.md} (100%) rename subjects/{rot14.md => rot14.en.md} (100%) rename subjects/{searchreplace.md => searchreplace.en.md} (100%) delete mode 100644 subjects/sortedlistmerge.md delete mode 100644 subjects/sortlistinsert.md delete mode 100644 subjects/strlen.md rename subjects/{swapbits.md => swapbits.en.md} (100%) rename subjects/{switchcase.md => switchcase.en.md} (100%) rename subjects/{union.md => union.en.md} (100%) rename subjects/{unmatch.md => unmatch.en.md} (100%) rename subjects/{wdmatch.md => wdmatch.en.md} (100%) rename subjects/{ztail.md => ztail.en.md} (100%) diff --git a/subjects/abort.md b/subjects/abort.en.md similarity index 100% rename from subjects/abort.md rename to subjects/abort.en.md diff --git a/subjects/activebits.md b/subjects/activebits.en.md similarity index 100% rename from subjects/activebits.md rename to subjects/activebits.en.md diff --git a/subjects/alphamirror.md b/subjects/alphamirror.en.md similarity index 100% rename from subjects/alphamirror.md rename to subjects/alphamirror.en.md diff --git a/subjects/bool.md b/subjects/bool.en.md similarity index 100% rename from subjects/bool.md rename to subjects/bool.en.md diff --git a/subjects/btreeapplybylevel.md b/subjects/btreeapplybylevel.en.md similarity index 100% rename from subjects/btreeapplybylevel.md rename to subjects/btreeapplybylevel.en.md diff --git a/subjects/btreedeletenode.md b/subjects/btreedeletenode.en.md similarity index 100% rename from subjects/btreedeletenode.md rename to subjects/btreedeletenode.en.md diff --git a/subjects/btreeisbinary.md b/subjects/btreeisbinary.en.md similarity index 100% rename from subjects/btreeisbinary.md rename to subjects/btreeisbinary.en.md diff --git a/subjects/btreelevelcount.md b/subjects/btreelevelcount.en.md similarity index 100% rename from subjects/btreelevelcount.md rename to subjects/btreelevelcount.en.md diff --git a/subjects/btreemax.md b/subjects/btreemax.en.md similarity index 100% rename from subjects/btreemax.md rename to subjects/btreemax.en.md diff --git a/subjects/btreemin.md b/subjects/btreemin.en.md similarity index 100% rename from subjects/btreemin.md rename to subjects/btreemin.en.md diff --git a/subjects/btreetransplant.md b/subjects/btreetransplant.en.md similarity index 100% rename from subjects/btreetransplant.md rename to subjects/btreetransplant.en.md diff --git a/subjects/cat.md b/subjects/cat.en.md similarity index 100% rename from subjects/cat.md rename to subjects/cat.en.md diff --git a/subjects/collatzcountdown.md b/subjects/collatzcountdown.en.md similarity index 100% rename from subjects/collatzcountdown.md rename to subjects/collatzcountdown.en.md diff --git a/subjects/comcheck.md b/subjects/comcheck.en.md similarity index 100% rename from subjects/comcheck.md rename to subjects/comcheck.en.md diff --git a/subjects/compact.md b/subjects/compact.en.md similarity index 100% rename from subjects/compact.md rename to subjects/compact.en.md diff --git a/subjects/countdown.md b/subjects/countdown.en.md similarity index 100% rename from subjects/countdown.md rename to subjects/countdown.en.md diff --git a/subjects/createelem.md b/subjects/createelem.en.md similarity index 100% rename from subjects/createelem.md rename to subjects/createelem.en.md diff --git a/subjects/dispfirstpar.md b/subjects/dispfirstpar.en.md similarity index 100% rename from subjects/dispfirstpar.md rename to subjects/dispfirstpar.en.md diff --git a/subjects/displastpar.md b/subjects/displastpar.en.md similarity index 100% rename from subjects/displastpar.md rename to subjects/displastpar.en.md diff --git a/subjects/displaya.md b/subjects/displaya.en.md similarity index 100% rename from subjects/displaya.md rename to subjects/displaya.en.md diff --git a/subjects/displayalpham.md b/subjects/displayalpham.en.md similarity index 100% rename from subjects/displayalpham.md rename to subjects/displayalpham.en.md diff --git a/subjects/displayalrevm.md b/subjects/displayalrevm.en.md similarity index 100% rename from subjects/displayalrevm.md rename to subjects/displayalrevm.en.md diff --git a/subjects/displayfile.md b/subjects/displayfile.en.md similarity index 100% rename from subjects/displayfile.md rename to subjects/displayfile.en.md diff --git a/subjects/displayz.md b/subjects/displayz.en.md similarity index 100% rename from subjects/displayz.md rename to subjects/displayz.en.md diff --git a/subjects/enigma.md b/subjects/enigma.en.md similarity index 100% rename from subjects/enigma.md rename to subjects/enigma.en.md diff --git a/subjects/firstword.md b/subjects/firstword.en.md similarity index 100% rename from subjects/firstword.md rename to subjects/firstword.en.md diff --git a/subjects/fixthemain.md b/subjects/fixthemain.en.md similarity index 100% rename from subjects/fixthemain.md rename to subjects/fixthemain.en.md diff --git a/subjects/hello.md b/subjects/hello.en.md similarity index 100% rename from subjects/hello.md rename to subjects/hello.en.md diff --git a/subjects/inter.md b/subjects/inter.en.md similarity index 100% rename from subjects/inter.md rename to subjects/inter.en.md diff --git a/subjects/join.md b/subjects/join.md deleted file mode 100644 index 2c88c853..00000000 --- a/subjects/join.md +++ /dev/null @@ -1,43 +0,0 @@ -## 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 - -```go -func Join(arstr []string, sep string) string { - -} -``` - -### Usage - -Here is a possible [program](TODO-LINK) to test your function : - -```go -package main - -import ( - "fmt" - student ".." -) - -func main() { - arrStr := []string{"hello", "how", "are", "you"} - joined := student.Join(arrStr, "--") - fmt.Println(joined) -} -``` - -And its output : - -```console -student@ubuntu:~/student/join$ go build -student@ubuntu:~/student/join$ ./join -hello--how--are--you -student@ubuntu:~/student/join$ -``` diff --git a/subjects/lastword.md b/subjects/lastword.en.md similarity index 100% rename from subjects/lastword.md rename to subjects/lastword.en.md diff --git a/subjects/listat.md b/subjects/listat.md deleted file mode 100644 index f71b4a60..00000000 --- a/subjects/listat.md +++ /dev/null @@ -1,60 +0,0 @@ -## listpushback - -### 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 - -```go -type Node struct { - Data interface{} - Next *Node -} - - -func ListAt(l *Node, nbr int) *Node{ - -} -``` - -### Usage - -Here is a possible [program](TODO-LINK) to test your function : - -```go -package main - -import ( - "fmt" - piscine ".." -) - -func main() { - link := &Node{} - - ListPushBack(link, "hello") - ListPushBack(link, "how are") - ListPushBack(link, "you") - ListPushBack(link, 1) - - fmt.Println() - - fmt.Println(ListAt(link, 3).Data) - fmt.Println(ListAt(link, 1).Data) - fmt.Println(ListAt(link, 7)) -} -``` - -And its output : - -```console -student@ubuntu:~/piscine/test$ go build -student@ubuntu:~/piscine/test$ ./test -you -hello - -student@ubuntu:~/piscine/test$ -``` diff --git a/subjects/listclear.md b/subjects/listclear.md deleted file mode 100644 index 5c059197..00000000 --- a/subjects/listclear.md +++ /dev/null @@ -1,77 +0,0 @@ -## listpushback - -### 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 - -```go -type Node struct { - Data interface{} - Next *Node -} - -type List struct { - Head *Node - Tail *Node -} - -func ListClear(l *List) { - -} -``` - -### Usage - -Here is a possible [program](TODO-LINK) to test your function : - -```go -package main - -import ( - "fmt" - piscine ".." -) - -type List = piscine.List -type Node = piscine.Node - -func PrintList(l *List) { - link := l.Head - for link != nil { - fmt.Print(link.Data, " -> ") - link = link.Next - } - fmt.Println(nil) -} - -func main() { - link := &List{} - - piscine.ListPushBack(link, "I") - piscine.ListPushBack(link, 1) - piscine.ListPushBack(link, "something") - piscine.ListPushBack(link, 2) - - fmt.Println("------list------") - PrintList(link) - piscine.ListClear(link) - fmt.Println("------updated list------") - PrintList(link) -} -``` - -And its output : - -```console -student@ubuntu:~/piscine/test$ go build -student@ubuntu:~/piscine/test$ ./test -------list------ -I -> 1 -> something -> 2 -> -------updated list------ - -student@ubuntu:~/piscine/test$ -``` diff --git a/subjects/listfind.md b/subjects/listfind.md deleted file mode 100644 index e4023cff..00000000 --- a/subjects/listfind.md +++ /dev/null @@ -1,64 +0,0 @@ -## listpushback - -### Instructions - -Write a function `ListFind` that returns the value of the first link that the function in the arguments its equal. - -- For this you shoud use the function `CompStr`. - -- Use pointers when ever you can. - -### Expected function and structure - -```go -type Node struct { - Data interface{} - Next *Node -} - -type List struct { - Head *Node - Tail *Node -} - -func CompStr(l *list) bool { - -} - -func ListFind(l *List, comp func(l *List) bool) *interface{} { - -} -``` - -### Usage - -Here is a possible [program](TODO-LINK) to test your function : - -```go -package main - -import ( - "fmt" - piscine ".." -) - -func main() { - link := &List{} - - piscine.ListPushBack(link, 1) - piscine.ListPushBack(link, "hello") - piscine.ListPushBack(link, "hello2") - piscine.ListPushBack(link, "hello3") - - fmt.Println(piscine.ListFind(link, CompStr)) -} -``` - -And its output : - -```console -student@ubuntu:~/piscine/test$ go build -student@ubuntu:~/piscine/test$ ./test -hello -student@ubuntu:~/piscine/test$ -``` diff --git a/subjects/listforeach.md b/subjects/listforeach.md deleted file mode 100644 index 7dbfd9b2..00000000 --- a/subjects/listforeach.md +++ /dev/null @@ -1,65 +0,0 @@ -## listpushback - -### 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 - -```go -type Node struct { - Data interface{} - Next *Node -} - -type List struct { - Head *Node - Tail *Node -} - -func ListForEach(l *list, f func(l *list)) { -} -``` - -### Usage - -Here is a possible [program](TODO-LINK) to test your function : - -```go -package main - -import ( - "fmt" - piscine ".." -) - -func main() { - link := &List{} - - piscine.ListPushBack(link, 1) - piscine.ListPushBack(link, 2) - piscine.ListPushBack(link, 3) - piscine.ListPushBack(link, 4) - - piscine.ListForEach(link, piscine.ListReverse) - - for link.Head != nil { - fmt.Println(link.Head.Data) - link.Head = link.Head.Next - } -} -``` - -And its output : - -```console -student@ubuntu:~/piscine/test$ go build -student@ubuntu:~/piscine/test$ ./test -4 -3 -2 -1 -student@ubuntu:~/piscine/test$ -``` diff --git a/subjects/listforeachif.md b/subjects/listforeachif.md deleted file mode 100644 index 81589024..00000000 --- a/subjects/listforeachif.md +++ /dev/null @@ -1,105 +0,0 @@ -## listpushback - -### Instructions - -Write a function `ListForEachIf` that applies a function given as argument to the information within some links of the list. - -- For this you will have to create a function `CompStr`, that returns a `bool`, to compare each elemente of the linked list, to see if it is a string, and than apply the function in the argument of `ListForEachIf`. - -- The function given as argument as to have a pointer as argument: `l *list`. - -- Use pointers wen ever you can. - -### Expected function and structure - -```go -type node struct { - data interface{} - next *node -} - -type list struct { - head *node - tail *node -} - -func CompStr(l *list) bool { - -} - -func ListForEachIf(l *list, f func(l *list), comp func(l *list) bool) { - -} -``` - -### Usage - -Here is a possible [program](TODO-LINK) to test your function : - -```go -package main - -import ( - "fmt" - piscine ".." -) - -func PrintElem(l *list) { - fmt.Println(l.head.data) -} - -func StringToInt(l *list) { - count := 1 - l.head.data = count -} - -func PrintList(l *list) { - m := l.head - for m != nil { - fmt.Print(m.data, " -> ") - m = m.next - } - - fmt.Print(l.tail) -} - -func main() { - link := &list{} - - piscine.ListPushBack(link, 1) - piscine.ListPushBack(link, "hello") - piscine.ListPushBack(link, 3) - piscine.ListPushBack(link, "there") - piscine.ListPushBack(link, 23) - piscine.ListPushBack(link, "!") - piscine.ListPushBack(link, 54) - - PrintAllList(link) - - fmt.Println() - fmt.Println("--------function applied--------") - piscine.ListForEachIf(link, PrintElem, CompStr) - - piscine.ListForEachIf(link, StringToInt, CompStr) - - fmt.Println("--------function applied--------") - PrintAllList(link) - - fmt.Println() -} -``` - -And its output : - -```console -student@ubuntu:~/piscine/test$ go build -student@ubuntu:~/piscine/test$ ./test -1 -> hello -> 3 -> there -> 23 -> ! -> 54 -> ---------function applied-------- -hello -there -! ---------function applied-------- -1 -> 1 -> 3 -> 1 -> 23 -> 1 -> 54 -> -student@ubuntu:~/piscine/test$ -``` diff --git a/subjects/listlast.md b/subjects/listlast.md deleted file mode 100644 index c53d4df8..00000000 --- a/subjects/listlast.md +++ /dev/null @@ -1,58 +0,0 @@ -## listpushback - -### Instructions - -Write a function `ListLast` that returns the last element of the linked list. - -### Expected function and structure - -```go -type Node struct { - Data interface{} - Next *Node -} - -type List struct { - Head *Node - Tail *Node -} - -func ListLast(l *list) *list { - -} -``` - -### Usage - -Here is a possible [program](TODO-LINK) to test your function : - -```go -package main - -import ( - "fmt" - piscine ".." -) - -func main() { - link := &list{} - link2 := &list{} - - piscine.ListPushBack(link, "three") - piscine.ListPushBack(link, 3) - piscine.ListPushBack(link, "1") - - fmt.Println(piscine.ListLast(link).head) - fmt.Println(piscine.ListLast(link2).head) -} -``` - -And its output : - -```console -student@ubuntu:~/piscine/test$ go build -student@ubuntu:~/piscine/test$ ./test -&{1 } - -student@ubuntu:~/piscine/test$ -``` diff --git a/subjects/listmerge.md b/subjects/listmerge.md deleted file mode 100644 index 49cafa93..00000000 --- a/subjects/listmerge.md +++ /dev/null @@ -1,78 +0,0 @@ -## listpushback - -### Instructions - -Write a function `ListMerge` that places elements of a list `l2` at the end of an other list `l1`. - -- You can't create new elements! - -- Use pointers when ever you can. - -### Expected function and structure - -```go -type NodeL struct { - Data interface{} - Next *NodeL -} - -type List struct { - Head *NodeL - Tail *NodeL -} - -func listMerge(l1 *List, l2 *List) { - -} -``` - -### Usage - -Here is a possible [program](TODO-LINK) to test your function : - -```go -package main - -import ( - "fmt" - student ".." -) - -func PrintList(l *List) { - m := l.Head - for m != nil { - fmt.Print(m.Data, " -> ") - m = m.Next - } - - fmt.Print(nil) - fmt.Println() -} - -func main() { - link := &List{} - link2 := &List{} - - student.ListPushBack(link, "a") - student.ListPushBack(link, "b") - student.ListPushBack(link, "c") - student.ListPushBack(link, "d") - - student.ListPushBack(link2, "e") - student.ListPushBack(link2, "f") - student.ListPushBack(link2, "g") - student.ListPushBack(link2, "h") - - student.ListMerge(link, link2) - PrintList(link) -} -``` - -And its output : - -```console -student@ubuntu:~/student/test$ go build -student@ubuntu:~/student/test$ ./test -a -> b -> c -> d -> e -> f -> g -> h -> -student@ubuntu:~/student/test$ -``` diff --git a/subjects/listpushback.md b/subjects/listpushback.md deleted file mode 100644 index eada7bf9..00000000 --- a/subjects/listpushback.md +++ /dev/null @@ -1,60 +0,0 @@ -## listpushback - -### 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 - -```go -type Node struct { - Data interface{} - Next *Node -} - -type List struct { - Head *Node - Tail *Node -} - -func ListPushBack(l *List, data interface{}) { -} -``` - -### Usage - -Here is a possible [program](TODO-LINK) to test your function : - -```go -package main - -import ( - "fmt" - piscine ".." -) - -func main() { - - link := &List{} - - piscine.ListPushBack(link, "Hello") - piscine.ListPushBack(link, "man") - piscine.ListPushBack(link, "how are you") - - for link.Head != nil { - fmt.Println(link.Head.Data) - link.Head = link.Head.Next - } -} -``` - -And its output : - -```console -student@ubuntu:~/piscine/test$ go build -student@ubuntu:~/piscine/test$ ./test -Hello -man -how are you -student@ubuntu:~/piscine/test$ -``` diff --git a/subjects/listpushfront.md b/subjects/listpushfront.md deleted file mode 100644 index 5ef0ea07..00000000 --- a/subjects/listpushfront.md +++ /dev/null @@ -1,60 +0,0 @@ -## listpushback - -### Instructions - -Write a function `ListPushBack` that inserts a new element `node` at the beginning of the list using `list` - -### Expected function and structure - -```go -type Node struct { - Data interface{} - Next *Node -} - -type List struct { - Head *Node - Tail *Node -} - -func ListPushFront(l *list, data interface{}) { - -} -``` - -### Usage - -Here is a possible [program](TODO-LINK) to test your function : - -```go -package main - -import ( - "fmt" - piscine ".." -) - -func main() { - link := &list{} - - piscine.ListPushFront(link, "Hello") - piscine.ListPushFront(link, "man") - piscine.ListPushFront(link, "how are you") - - for link.head != nil { - fmt.Println(link.head.data) - link.head = link.head.next - } -} -``` - -And its output : - -```console -student@ubuntu:~/piscine/test$ go build -student@ubuntu:~/piscine/test$ ./test -how are you -man -Hello -student@ubuntu:~/piscine/test$ -``` diff --git a/subjects/listpushpara.md b/subjects/listpushpara.en.md similarity index 100% rename from subjects/listpushpara.md rename to subjects/listpushpara.en.md diff --git a/subjects/listremoveif.md b/subjects/listremoveif.md deleted file mode 100644 index 04ee54ab..00000000 --- a/subjects/listremoveif.md +++ /dev/null @@ -1,99 +0,0 @@ -## listpushback - -### 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 - -```go -type NodeL struct { - Data interface{} - Next *NodeL -} - -type List struct { - Head *NodeL - Tail *NodeL -} - -func ListPushFront(l *List, data interface{}) { - -} -``` - -### Usage - -Here is a possible [program](TODO-LINK) to test your function : - -```go -package main - -import ( - "fmt" - piscine ".." -) - -func PrintList(l *List) { - m := l.Head - for m != nil { - fmt.Print(m.Data, " -> ") - m = m.Next - } - - fmt.Print(nil) - fmt.Println() -} - -func main() { - link := &List{} - link2 := &List{} - link3 := &List{} - - - fmt.Println("----normal state----") - student.ListPushBack(link2, 1) - PrintList(link2) - ListRemoveIf(link2, 1) - fmt.Println("------answer-----") - PrintList(link) - fmt.Println() - - fmt.Println("----normal state----") - student.ListPushBack(link, 1) - student.ListPushBack(link, "Hello") - student.ListPushBack(link, 1) - student.ListPushBack(link, "There") - student.ListPushBack(link, 1) - student.ListPushBack(link, 1) - student.ListPushBack(link, "How") - student.ListPushBack(link, 1) - student.ListPushBack(link, "are") - student.ListPushBack(link, "you") - student.ListPushBack(link, 1) - PrintList(link) - - ListRemoveIf(link, 1) - fmt.Println("------answer-----") - PrintList(link) -} -``` - -And its output : - -```console -student@ubuntu:~/student/test$ go build -student@ubuntu:~/student/test$ ./test -----normal state---- -1 -> -------answer----- - - -----normal state---- -1 -> Hello -> 1 -> There -> 1 -> 1 -> How -> 1 -> are -> you -> 1 -> -------answer----- -Hello -> There -> How -> are -> you -> -student@ubuntu:~/piscine/test$ -``` diff --git a/subjects/listreverse.md b/subjects/listreverse.md deleted file mode 100644 index 0ca64fc0..00000000 --- a/subjects/listreverse.md +++ /dev/null @@ -1,65 +0,0 @@ -## listpushback - -### 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 - -```go -type Node struct { - Data interface{} - Next *Node -} - -type List struct { - Head *Node - Tail *Node -} - -func ListReverse(l *list) { -} -``` - -### Usage - -Here is a possible [program](TODO-LINK) to test your function : - -```go -package main - -import ( - "fmt" - piscine ".." -) - -func main() { - link := &List{} - - listPushBack(link, 1) - listPushBack(link, 2) - listPushBack(link, 3) - listPushBack(link, 4) - - listReverse(link) - - for link.Head != nil { - fmt.Println(link.Head.Data) - link.Head = link.Head.Next - } -} -``` - -And its output : - -```console -student@ubuntu:~/piscine/test$ go build -student@ubuntu:~/piscine/test$ ./test -4 -3 -2 -1 -student@ubuntu:~/piscine/test$ -``` diff --git a/subjects/listsize.md b/subjects/listsize.md deleted file mode 100644 index 2b48b3f8..00000000 --- a/subjects/listsize.md +++ /dev/null @@ -1,56 +0,0 @@ -## listpushback - -### Instructions - -Write a function `ListSize` that returns the number of elements in the list. - -### Expected function and structure - -```go -type Node struct { - Data interface{} - Next *Node -} - -type List struct { - Head *Node - Tail *Node -} - -func ListSize(l *List) int { - -} -``` - -### Usage - -Here is a possible [program](TODO-LINK) to test your function : - -```go -package main - -import ( - "fmt" - piscine ".." -) - -func main() { - link := &List{} - - piscine.ListPushFront(link, "Hello") - piscine.ListPushFront(link, "2") - piscine.ListPushFront(link, "you") - piscine.ListPushFront(link, "man") - - fmt.Println(piscine.ListSize(link)) -} -``` - -And its output : - -```console -student@ubuntu:~/piscine/test$ go build -student@ubuntu:~/piscine/test$ ./test -4 -student@ubuntu:~/piscine/test$ -``` diff --git a/subjects/listsort.md b/subjects/listsort.md deleted file mode 100644 index 09401c9b..00000000 --- a/subjects/listsort.md +++ /dev/null @@ -1,89 +0,0 @@ -## listpushback - -### Instructions - -Write a function `ListSort` that sorts the linked list by ascending order. - -- This time you only will have the `Nodee` structure. - -- Try to use recursive. - -- Use pointers when ever you can. - -### Expected function and structure - -```go -type Nodee struct { - Data int - Next *Nodee -} - -func ListSort(l *NodeL) *NodeL { - -} -``` - -### Usage - -Here is a possible [program](TODO-LINK) to test your function : - -```go -package main - -import ( - "fmt" - student ".." -) - -//Prints the list -func PrintList(l *Nodee) { - m := l - for m != nil { - fmt.Print(m.Data, " -> ") - m = m.next - } - - fmt.Print(nil) - fmt.Println() -} - -//insert elements -func listPushBack(l *Nodee, Data int) { - - n := &Nodee{} - n.Data = Data - n.next = nil - - if l == nil { - l = n - return - } - - iterator := l - for iterator.next != nil { - iterator = iterator.next - } - iterator.next = n -} - -func main() { - link := &Nodee{} - - listPushBack(link, 5) - listPushBack(link, 4) - listPushBack(link, 3) - listPushBack(link, 2) - listPushBack(link, 1) - - PrintList(student.ListSort(link)) -} -``` - -And its output : - -```console -student@ubuntu:~/student/test$ go build -student@ubuntu:~/student/test$ ./test -0 -> 1 -> 2 -> 3 -> 4 -> 5 -> -student@ubuntu:~/student/test$ -``` diff --git a/subjects/max.md b/subjects/max.en.md similarity index 100% rename from subjects/max.md rename to subjects/max.en.md diff --git a/subjects/onlya.md b/subjects/onlya.en.md similarity index 100% rename from subjects/onlya.md rename to subjects/onlya.en.md diff --git a/subjects/onlyz.md b/subjects/onlyz.en.md similarity index 100% rename from subjects/onlyz.md rename to subjects/onlyz.en.md diff --git a/subjects/pilot.md b/subjects/pilot.en.md similarity index 100% rename from subjects/pilot.md rename to subjects/pilot.en.md diff --git a/subjects/point.md b/subjects/point.en.md similarity index 100% rename from subjects/point.md rename to subjects/point.en.md diff --git a/subjects/printbits.md b/subjects/printbits.en.md similarity index 100% rename from subjects/printbits.md rename to subjects/printbits.en.md diff --git a/subjects/rectangle.md b/subjects/rectangle.en.md similarity index 100% rename from subjects/rectangle.md rename to subjects/rectangle.en.md diff --git a/subjects/repeatalpha.md b/subjects/repeatalpha.en.md similarity index 100% rename from subjects/repeatalpha.md rename to subjects/repeatalpha.en.md diff --git a/subjects/reversebits.md b/subjects/reversebits.en.md similarity index 100% rename from subjects/reversebits.md rename to subjects/reversebits.en.md diff --git a/subjects/rot13.md b/subjects/rot13.en.md similarity index 100% rename from subjects/rot13.md rename to subjects/rot13.en.md diff --git a/subjects/rot14.md b/subjects/rot14.en.md similarity index 100% rename from subjects/rot14.md rename to subjects/rot14.en.md diff --git a/subjects/searchreplace.md b/subjects/searchreplace.en.md similarity index 100% rename from subjects/searchreplace.md rename to subjects/searchreplace.en.md diff --git a/subjects/sortedlistmerge.md b/subjects/sortedlistmerge.md deleted file mode 100644 index 392e5a6d..00000000 --- a/subjects/sortedlistmerge.md +++ /dev/null @@ -1,71 +0,0 @@ -## listpushback - -### Instructions - -Write a function `SortedListMerge` that mereges two lists, `l1` and `l2`, but you have to join them in ascending order. - -- Tip each list as to be already sorted, and initialized with 0. - -- Use pointers when ever you can. - -### Expected function and structure - -```go -type Nodee struct { - Data interface{} - Next *Nodee -} - -func SortedListMerge(l1 *Nodee, l2 *Nodee) *Nodee { - -} -``` - -### Usage - -Here is a possible [program](TODO-LINK) to test your function : - -```go -package main - -import ( - "fmt" - piscine ".." -) - -func PrintList(l *Nodee) { - m := l - for m != nil { - fmt.Print(m.Data, " -> ") - m = m.Next - } - - fmt.Print(nil) - fmt.Println() -} - -func main() { - link := &Nodee{} - link2 := &Nodee{} - - piscine.ListPushBack(link, "5") - piscine.ListPushBack(link, "3") - piscine.ListPushBack(link, "7") - - piscine.ListPushBack(link2, "1") - piscine.ListPushBack(link2, "-2") - piscine.ListPushBack(link2, "4") - piscine.ListPushBack(link2, "6") - - PrintList(SortedListMerge(link, link2)) -} -``` - -And its output : - -```console -student@ubuntu:~/piscine/test$ go build -student@ubuntu:~/piscine/test$ ./test --2 -> 0 -> 0 -> 1 -> 3 -> 4 -> 5 -> 6 -> 7 -> -student@ubuntu:~/piscine/test$ -``` diff --git a/subjects/sortlistinsert.md b/subjects/sortlistinsert.md deleted file mode 100644 index 09340e70..00000000 --- a/subjects/sortlistinsert.md +++ /dev/null @@ -1,87 +0,0 @@ -## listpushback - -### Instructions - -Write a function `SortListInsert` that inserts `Data_ref` in the linked list, but it as to remain sorted in ascending order. - -- The list as to be alredy sorted. - -- Use pointers when ever you can. - -### Expected function and structure - -```go -type Nodee struct { - Data int - Next *Nodee -} - -func SortListInsert(l *Nodee, Data_ref int) *Nodee{ - -} -``` - -### Usage - -Here is a possible [program](TODO-LINK) to test your function : - -```go -package main - -import ( - "fmt" - piscine ".." -) - -//Prints the list -func PrintList(l *Nodee) { - m := l - for m != nil { - fmt.Print(m.Data, " -> ") - m = m.Next - } - fmt.Print(nil) - fmt.Println() -} - -//insert elements -func listPushBack(l *Nodee, Data int) { - n := &Nodee{} - n.Data = Data - n.Next = nil - if l == nil { - l = n - return - } - iterator := l - for iterator.Next != nil { - iterator = iterator.Next - } - iterator.Next = n -} - -func main() { - - link := &Nodee{} - - listPushBack(link, 1) - listPushBack(link, 4) - listPushBack(link, 9) - - PrintList(link) - - link = sortListInsert(link, -2) - link = sortListInsert(link, 2) - PrintList(link) -} -``` - -And its output : - -```console -student@ubuntu:~/piscine/test$ go build -student@ubuntu:~/piscine/test$ ./test --2 -> 0 -> 1 -> 2 -> 4 -> 9 -> -lee@lee:~/Documents/work/day11/11-16-sortlistinsert/so -student@ubuntu:~/piscine/test$ -``` diff --git a/subjects/strlen.md b/subjects/strlen.md deleted file mode 100644 index f129f9f6..00000000 --- a/subjects/strlen.md +++ /dev/null @@ -1,24 +0,0 @@ -## strlen - -### Instructions - -Write a function that returns the length of a string. - -- `len` is forbidden - -### Expected function and structure - -```go -func Strlen(str string) int { - -} -``` - -And its output : - -```console -student@ubuntu:~/piscine/test$ go build -student@ubuntu:~/piscine/test$ ./test -4 -student@ubuntu:~/piscine/test$ -``` diff --git a/subjects/swapbits.md b/subjects/swapbits.en.md similarity index 100% rename from subjects/swapbits.md rename to subjects/swapbits.en.md diff --git a/subjects/switchcase.md b/subjects/switchcase.en.md similarity index 100% rename from subjects/switchcase.md rename to subjects/switchcase.en.md diff --git a/subjects/union.md b/subjects/union.en.md similarity index 100% rename from subjects/union.md rename to subjects/union.en.md diff --git a/subjects/unmatch.md b/subjects/unmatch.en.md similarity index 100% rename from subjects/unmatch.md rename to subjects/unmatch.en.md diff --git a/subjects/wdmatch.md b/subjects/wdmatch.en.md similarity index 100% rename from subjects/wdmatch.md rename to subjects/wdmatch.en.md diff --git a/subjects/ztail.md b/subjects/ztail.en.md similarity index 100% rename from subjects/ztail.md rename to subjects/ztail.en.md