Merge sorted lists in python

前端 未结 9 1004
花落未央
花落未央 2020-12-19 00:50

I have a bunch of sorted lists of objects, and a comparison function

class Obj :
    def __init__(p) :
        self.points = p
def cmp(a, b) :
    return a.p         


        
9条回答
  •  孤城傲影
    2020-12-19 00:55

    I asked a similar question and got some excellent answers:

    • Joining a set of ordered-integer yielding Python iterators

    The best solutions from that question are variants of the merge algorithm, which you can read about here:

    • Wikipedia: Merge Algorithm

提交回复
热议问题