TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Aug 2016 |
Maintained by Shabib Hossain.
This cocoapod helps to find the nearest ceiling double/float value from a double/float array by performing a binary search operation.
SHBinarySearchForRange is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "SHBinarySearchForRange"
#import "SHBinarySearchForRange.h"
NSArray *array = @[@0.12f, @0.23f, @0.3f, @0.345f, @0.967f, @1.0f];
SHBinarySearchForRange *binarySearch = [[SHBinarySearchForRange alloc] initWithValues:array];
NSInteger index = [binarySearch indexOfClosestCeilingForSearchItem:10.67575f];
NSNumber *valAtIndex = [array objectAtIndex:index];
NSLog(@"Value close to range: %f", valAtIndex.doubleValue);
Ahmad Shabibul Hossain
SHBinarySearchForRange is available under the MIT license. See the LICENSE file for more info.