Skip to main content

PriorityQueue.sort

Returns a sorted list according to the rules of the comparator

Usage

sort()

Returns:
      list
            list of the sorted elements

Example

from jellybeans.structures import PriorityQueue as PQpq = PQ(comparator=lambda x,y: x<=y) # Min heappq.insert("a")pq.insert("abcd")pq.insert("abe")pq.insert("c")print(pq.sort()) # ['a', 'abcd', 'abe', 'c']