Browse Source

Merge pull request #221 from 01-edu/listreverse-ch

fix sintax error in listreverse
pull/223/head
LEEDASILVA 5 years ago committed by GitHub
parent
commit
d843a39e19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 32
      subjects/listreverse.en.md

32
subjects/listreverse.en.md

@ -9,17 +9,17 @@ Write a function `ListReverse` that reverses the elements order of a given linke
### Expected function and structure ### Expected function and structure
```go ```go
type node struct { type NodeL struct {
data interface{} Data interface{}
next *node Next *NodeL
} }
type list struct { type List struct {
head *node Head *NodeL
tail *node Tail *NodeL
} }
func ListReverse(l *list) { func ListReverse(l *List) {
} }
``` ```
@ -36,18 +36,18 @@ import (
) )
func main() { func main() {
link := &list{} link := &piscine.List{}
listPushBack(link, 1) piscine.ListPushBack(link, 1)
listPushBack(link, 2) piscine.ListPushBack(link, 2)
listPushBack(link, 3) piscine.ListPushBack(link, 3)
listPushBack(link, 4) piscine.ListPushBack(link, 4)
listReverse(link) piscine.ListReverse(link)
for link.head != nil { for link.Head != nil {
fmt.Println(link.head.data) fmt.Println(link.Head.Data)
link.head = link.head.next link.Head = link.Head.Next
} }
} }
``` ```

Loading…
Cancel
Save