wzugang / radixtree-1 Goto Github PK
View Code? Open in Web Editor NEWThis project forked from j0sh/radixtree
The finest radix tree this side of the Linux kernel.
License: Other
This project forked from j0sh/radixtree
The finest radix tree this side of the Linux kernel.
License: Other
The Finest Radix Tree this side of the Linux Kernel Josh Allmann <[email protected]> Implementation of a Radix Tree. This is well suited to 'dense' sets of keys, eg those that have many leading bits in common (a prefix). For more information on the Radix Tree and its variations, see: * http://www.csse.monash.edu.au/~lloyd/tildeAlgDS/Tree/PATRICIA/ * http://cr.yp.to/critbit.html * https://secure.wikimedia.org/wikipedia/en/wiki/Radix_tree Keys are character strings, and must be null terminated. API: rxt_node *rxt_init(); Initializes a radix tree node. This will allocate memory for the root node and zero it out. It should be freed with rxt_free. Returns a pointer to the root node, or NULL if malloc fails. void* rxt_get(char *key, rxt_node *root); Returns the value associated with the key, starting the search from the node at root. If the key is not found, NULL is returned. int rxt_put(char *key, void *value, rxt_node *root); Inserts the key in the tree, starting from the root node. The key must be null terminated. Returns 0 for success, -1 for error. This could indicate a malloc error, or an already existing key (values will not be overwritten). void* rxt_delete(char *key, rxt_node *root); Removes the key from the tree, and returns its value. If the key is not found, NULL is returned. void rxt_free(char *key); Empties and frees the nodes in the tree. Since this excludes keys and values, this might not be very useful unless the K/Vs are managed out-of- tree. Extras: -DLSB_FIRST This compiler flag will start the bit comparision at the LSB (least significant bit), rather than the MSB as is the default. This will result in fewer compares when inserting and deleting, and thus slightly faster performance. However, lexical ordering is lost after the first differing byte*, and results may be unpredictable if a strict ordering is needed. Eg, a LSB-first comparison would rank "foob" before "fooa" because 'a' is ASCII 97 and 'b' is ASCII 98, and the even final bit of 'b' is first, before the odd bit of 'a'. * LSB (or MSB)-first searches are only done at the first differing byte between two keys. Bytes are still searched in order; it is the bits within those bytes that are compared differently. For example, given two keys "fooa" and "foob", "foo" would be skipped over, then the LSB search would kick in when comparing "a" and "b". Sort of a reverse endianness. LICENSE: Simplified BSD. See LICENSE file.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.