|
|
@ -6,10 +6,6 @@ Write a function `ListSort` that sorts the linked list by ascending order. |
|
|
|
|
|
|
|
|
|
|
|
- This time you only will have the `node` structure. |
|
|
|
- This time you only will have the `node` structure. |
|
|
|
|
|
|
|
|
|
|
|
- Try to use recursive. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- Use pointers when ever you can. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Expected function and structure |
|
|
|
### Expected function and structure |
|
|
|
|
|
|
|
|
|
|
|
```go |
|
|
|
```go |
|
|
@ -37,13 +33,12 @@ import ( |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
func PrintList(l *piscine.NodeI) { |
|
|
|
func PrintList(l *piscine.NodeI) { |
|
|
|
m := l |
|
|
|
it := l |
|
|
|
for m != nil { |
|
|
|
for it != nil { |
|
|
|
fmt.Print(m.Data, " -> ") |
|
|
|
fmt.Print(it.Data, " -> ") |
|
|
|
m = m.Next |
|
|
|
it = it.Next |
|
|
|
} |
|
|
|
} |
|
|
|
fmt.Print(nil) |
|
|
|
fmt.Print(nil, "\n") |
|
|
|
fmt.Println() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func listPushBack(l *piscine.NodeI, data int) *piscine.NodeI { |
|
|
|
func listPushBack(l *piscine.NodeI, data int) *piscine.NodeI { |
|
|
|