Skip to content
Snippets Groups Projects
Select Git revision
  • 4527a199d3cc7ab06c93efa711b8e7e6f75f0d68
  • master default protected
2 results

fibo-comp.py

Blame
  • Forked from Vuillemot Romain / INF-TC1
    Source project has a limited visibility.
    listes-fusion.py 367 B
    def fusion(l1, l2):
    
    	res = []
    	i = 0
    	j = 0
    
    	while i < len(l1) and j < len(l2):
    		if l1[i] < l2[j]:
    			res.append(l1[i])
    			i += 1
    		else: 
    			res.append(l2[i])
    			j += 1
    
    	while i < len(l1):
    		res.append(l1[i])
    		i += 1
    
    	while j < len(l2):
    		res.append(l2[j])
    		j += 1
    
    	return res
    
    print(fusion([2, 2, 3], [0, 4, 5, 14, 20, 25]))
    # [0, 2, 2, 3, 4, 5, 14, 20, 25]