Skewlia.jl

Skewlia.SkewliaModule

Skewlia - mergable priority queues

    heap = Skewlia.SkewHeap()

    # Insert one at a time
    for job in some_list_of_jobs
        Skewlia.put!(heap, job)
    end

    # Insert all at once
    Skewlia.put!(heap, some_list_of_jobs...)

    # Retrieve jobs in order (using <=)
    while !Skewlia.is_empty(heap)
        job = Skewlia.get!(heap)
        do_stuff_with(job)
    end

    # Or as an iterator
    for job in heap
        do-stuff_with(job)
    end
source
Skewlia.SkewHeapType
SkewHeap() ::SkewHeap

Initialize a new skew heap. Elements inserted into the heap will be ordered using <=.

source
Base.iterateFunction
iterate(h::SkewHeap)

Returns an iterator that will sequentially retrieve each item from the heap. Adding new items while iterating over the heap is perfectly acceptable.

heap = Skewlia.SkewHeap()

Skewlia.put!("foo", "bar", "baz", "bat")

for abused_string in heap
    println(abused_string)
end
source
Skewlia.peekMethod
peek(h::SkewHeap)

Returns the next item from the heap without removing it, or nothing if empty.

source
Skewlia.put!Method
put(h::SkewHeap, items...)

Inserts new items into the heap and returns the heap's new size.

source
Skewlia.take!Method
take(h::SkewHeap)

Removes and returns the next item from the heap or nothing if it is empty.

source