Tag Archives: Binary

Poignant: Xml meets Huffman

There’s a spec at the w3c about compressing (XML) named “Efficient XML Interchange” Format taking into account the grammar and likelihood of atoms within the document. They indeed use something similar the the Huffman Coding. The results are quite impressive – nice charts!

Binary Search NSArray

Though CFArray comes with binary search capability, NSArray does not – at least not within the iPhone SDK. The indexOfObject:inSortedRange:options:usingComparator: can’t be found. Plus the CFArrayBSearchValues doesn’t tell you whether the key actually is part of the list or not. That’s what the Java JDK does, so let’s implement some category methods -(NSInteger)binarySearch:(id)key; -(NSInteger)binarySearch:(id)key usingSelector:(SEL)comparator; [...]

CocoaTouch, CoreData and binary String Search

The query optimiser for NSPredicate queries ontop CoreData/SQLite on the iPhone is a bit rudimentary (cough) and so I had to optimise myself to get binary-search enabled quick results: