GithubHelp home page GithubHelp logo

isabella232 / triemap-1 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from redislabs/triemap

0.0 0.0 0.0 47 KB

C implementation of a compressed trie lookup map

License: BSD 2-Clause "Simplified" License

Makefile 2.23% C 90.96% C++ 6.81%

triemap-1's Introduction

triemap

C implementation of a compact trie lookup map

Features

  • High memory efficiency, fast lookups and insertions
  • Deletions with node rejoining
  • Prefix lookups with an iterator API
  • Random key extraction
  • No external dependencies, just one C and one H file

Basic Example

 TrieMap *tm = NewTrieMap();

 char buf[32];

 for (int i = 0; i < 100; i++) {
    sprintf(buf, "key%d", i);
    TrieMap_Add(tm, buf, strlen(buf), NULL, NULL);
 }
 
  TrieMapIterator *it = TrieMap_Iterate(tm, "key1", 4);
  
  char *str = NULL;
  tm_len_t len = 0;
  void *ptr = NULL;

  /* Prefix Iteration */
  while (TrieMapIterator_Next(it, &str, &len, &ptr)) {
    printf("Found key %.*s\n", (int)len, str);
  }
  
  TrieMapIterator_Free(&it);
  TrieMap_Free(tm, NULL);
  

triemap-1's People

Contributors

dvirsky avatar swilly22 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.