A simple static heap implementation.
This commit is contained in:
1 parent
c8ab6b3b3c
commit
0a4785e4ef
2 files changed
+140
No files matched your search
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// MP42Heap.h
|
||||
// MP42Foundation
|
||||
//
|
||||
// Created by Damiano Galassi on 29/06/14.
|
||||
// Copyright (c) 2014 Damiano Galassi. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
/**
|
||||
* A simple heap/priority queue implementations with a static size.
|
||||
* It takes a NSComparator in input.
|
||||
*/
|
||||
@interface MP42Heap : NSObject {
|
||||
@private
|
||||
id *_array;
|
||||
uint64 _size;
|
||||
uint64 _len;
|
||||
|
||||
NSComparator _cmptr;
|
||||
}
|
||||
|
||||
- (instancetype)initWithCapacity:(NSUInteger)numItems andComparator:(NSComparator)cmptr;
|
||||
|
||||
- (void)insert:(id)item;
|
||||
- (id)extract NS_RETURNS_RETAINED;
|
||||
|
||||
- (NSInteger)count;
|
||||
|
||||
- (BOOL)isFull;
|
||||
- (BOOL)isEmpty;
|
||||
|
||||
@end
|
||||
Reference in new issue
Block a user