|
|
@ -6,8 +6,6 @@ Write a function `SortedListMerge` that mereges two lists, `n1` and `n2`, but it |
|
|
|
|
|
|
|
|
|
|
|
- Tip each list as to be already sorted. |
|
|
|
- Tip each list as to be already sorted. |
|
|
|
|
|
|
|
|
|
|
|
- Use pointers when ever you can. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Expected function and structure |
|
|
|
### Expected function and structure |
|
|
|
|
|
|
|
|
|
|
|
```go |
|
|
|
```go |
|
|
@ -33,13 +31,12 @@ type node = piscine.NodeI |
|
|
|
type nodes = piscine.NodeI |
|
|
|
type nodes = piscine.NodeI |
|
|
|
|
|
|
|
|
|
|
|
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 { |
|
|
|