Latest 0.1
Homepage https://github.com/matthewcheok/MCBinaryHeap
License MIT
Platforms ios 7.0, osx 10.9, requires ARC
Authors

MCBinaryHeap License MIT

Badge w/ Version
Badge w/ Platform

An Objective-C wrapper of CFBinaryHeap. Core Foundation priority queue implementation.

Installation

Add the following to your CocoaPods Podfile

pod 'MCBinaryHeap', '~> 0.1'

or clone as a git submodule,

or just copy files in the MCBinaryHeap folder into your project.

Using MCBinaryHeap

Objects you add to MCBinaryHeap must implement - (NSComparisonResult)compare:(id)otherObject;.

The usage is very similar to NSMutableArray.

MCBinaryHeap *heap = [MCBinaryHeap heapWithArray:@[@3, @4, @5, @2]];
[heap addObject:@(1)];
NSLog(@"heap count %lu", heap.count);

[heap enumerateObjectsUsingBlock: ^(id object) {
    NSLog(@"heap item %@", object);
}];

NSLog(@"min object %@", [heap popMinimumObject]);

See the demo project for more details.

License

MCBinaryHeap is under the MIT license.

Latest podspec

{
    "name": "MCBinaryHeap",
    "version": "0.1",
    "platforms": {
        "ios": "7.0",
        "osx": "10.9"
    },
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "summary": "An Objective-C wrapper of CFBinaryHeap. Core Foundation priority queue implementation.",
    "homepage": "https://github.com/matthewcheok/MCBinaryHeap",
    "authors": {
        "Matthew Cheok": "[email protected]"
    },
    "requires_arc": true,
    "source": {
        "git": "https://github.com/matthewcheok/MCBinaryHeap.git",
        "branch": "master",
        "tag": "0.1"
    },
    "source_files": "MCBinaryHeap/*.{h,m}",
    "public_header_files": "MCBinaryHeap/*.h"
}

Pin It on Pinterest

Share This