Code golf: combining multiple sorted lists into a single sorted list

前端 未结 26 1948
余生分开走
余生分开走 2020-12-29 12:42

Implement an algorithm to merge an arbitrary number of sorted lists into one sorted list. The aim is to create the smallest working programme, in whatever language you like.

26条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-29 13:05

    VB.NET (2008) 185 chars

    Accepts List(Of List(Of Byte))

    Function s(i)
    
        s=New List(Of Byte)
    
        Dim m,c
        Dim N=Nothing
    
        Do
            m=N
            For Each l In i:
                If l.Count AndAlso(l(0)N Then s.Add(m):c.Remove(m)       
    
        Loop Until m=N
    
    End Function
    

提交回复
热议问题