mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
265 B
17 lines
265 B
4 years ago
|
package correct
|
||
4 years ago
|
|
||
|
func SortedListMerge(l1 *NodeI, l2 *NodeI) *NodeI {
|
||
|
if l1 == nil {
|
||
|
return l2
|
||
|
}
|
||
|
if l2 == nil {
|
||
|
return l1
|
||
|
}
|
||
|
if l1.Data <= l2.Data {
|
||
|
l1.Next = SortedListMerge(l1.Next, l2)
|
||
|
return l1
|
||
|
}
|
||
|
l2.Next = SortedListMerge(l1, l2.Next)
|
||
|
return l2
|
||
|
}
|