Browse Source

raeame btreeapplybylevel from quest 12

content-update
lee 5 years ago
parent
commit
c4ab04db9c
  1. 20
      subjects/btreeapplybylevel.en.md
  2. 20
      subjects/btreeapplybylevel.fr.md

20
subjects/btreeapplybylevel.en.md

@ -2,7 +2,7 @@
### Instructions ### Instructions
Write a function, BTreeApplyByLevel, that applies the function given by fn to each node of the tree given by root. 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. This function must have the following signature.
@ -23,26 +23,26 @@ package main
import ( import (
"fmt" "fmt"
student ".." piscine ".."
) )
func main() { func main() {
root := &student.TreeNode{Data: "4"} root := &piscine.TreeNode{Data: "4"}
student.BTreeInsertData(root, "1") piscine.BTreeInsertData(root, "1")
student.BTreeInsertData(root, "7") piscine.BTreeInsertData(root, "7")
student.BTreeInsertData(root, "5") piscine.BTreeInsertData(root, "5")
student.BTreeApplyByLevel(root, fmt.Println) piscine.BTreeApplyByLevel(root, fmt.Println)
} }
``` ```
And its output : And its output :
```console ```console
student@ubuntu:~/student/btreeapplybylevel$ go build student@ubuntu:~/student/test$ go build
student@ubuntu:~/student/btreeapplybylevel$ ./btreeapplybylevel student@ubuntu:~/student/test$ ./test
4 4
1 1
7 7
5 5
student@ubuntu:~/student/btreeapplybylevel$ student@ubuntu:~/student/test$
``` ```

20
subjects/btreeapplybylevel.fr.md

@ -2,7 +2,7 @@
### Instructions ### Instructions
Write a function, BTreeApplyByLevel, that applies the function given by fn to each node of the tree given by root. 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. This function must have the following signature.
@ -23,26 +23,26 @@ package main
import ( import (
"fmt" "fmt"
student ".." piscine ".."
) )
func main() { func main() {
root := &student.TreeNode{Data: "4"} root := &piscine.TreeNode{Data: "4"}
student.BTreeInsertData(root, "1") piscine.BTreeInsertData(root, "1")
student.BTreeInsertData(root, "7") piscine.BTreeInsertData(root, "7")
student.BTreeInsertData(root, "5") piscine.BTreeInsertData(root, "5")
student.BTreeApplyByLevel(root, fmt.Println) piscine.BTreeApplyByLevel(root, fmt.Println)
} }
``` ```
And its output : And its output :
```console ```console
student@ubuntu:~/student/btreeapplybylevel$ go build student@ubuntu:~/student/test$ go build
student@ubuntu:~/student/btreeapplybylevel$ ./btreeapplybylevel student@ubuntu:~/student/test$ ./test
4 4
1 1
7 7
5 5
student@ubuntu:~/student/btreeapplybylevel$ student@ubuntu:~/student/test$
``` ```

Loading…
Cancel
Save