Coder Social home page Coder Social logo

frequent's Introduction

frequent

Uses a modified version of Demaine's algorithm (Paper Title: Frequency Estimation of Internet Packet Streams with Limited Space). This project is written in POSIX compliant C, without dynamic memory allocation. This is meant to be used in embedded systems or systems with very limited memory where dynamic allocation is not allowed. Memory use in this library is deterministic and depends only on the number of top elements you want to keep track of. See "Limitations" for why you shouldn't use this library if you don't care about using malloc.

Usage

As this is a single header single source file library, you can simply add it to your source and include it as any other source and header. If you want to made it a static library for some reason I leave that as an exercise for the reader.

You MUST use init_freq() to get a new frequency tracker, unless you want to set it up yourself. For example: struct freq_s my_freq = init_freq();

Limitations

Because we can't use malloc and the algorithm relies on linked lists for its really good asymptotic performance of O(1), we have to "fake" a linked list. This means that we need to check if elements are already in use before adding them to the linked list. In reality then, this modified algorithm runs in O(m), where m is the number of most frequent elements you want to keep track of, which is usually a small number.

frequent's People

Contributors

marwankallal avatar

Watchers

James Cloos avatar  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.