Coder Social home page Coder Social logo

ds-lib's Introduction

Data Structure Library

A C++ library of selected data-structures that I've implemented (or ported) during the course of my research.

Compiling and installing

This library employs CMake as its build tool for building across different platforms. The minimum required versison of CMake is 2.8.

To compile the library and all included benchmarks run the following:

mkdir build
cd build
cmake ../
make

This will create the executables and libraries within the build directory (under the bin/ and lib/ directories respectively). In order to install the library and its benchmarks, additionally run:

make install

Usage

A sample use-case of the suffix tree is shown below:

#include <suffix-tree.h>
#include <iostream>

int main(int argc, char **argv) {
    
    // Dummy input
    std::string input = "mississippi";

    // Create the suffix tree
    dsl::SuffixTree suffix_tree(input);

    // Search for substrings
    std::vector<int64_t> results;
    suffix_tree.search(results, "ssi");

    // Display the results
    for(auto offset: results) {
        std::cout << "Found at offset " << offset << std::endl;
    }
    
    return 0;
}

ds-lib's People

Contributors

anuragkh avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

mindis

ds-lib's Issues

Allocate space for input in text indexes.

Currently, the text index data-structures hold on to references of the input data (const char *) that they are passed. Once the original data is destroyed, the data-structures begin to mal-function since the reference it's holding on to points to data that may no longer exist.

A simple solution is to copy the entire input data to a newly allocated buffer within each of the data-structures. The responsibility of freeing the original input buffer would lie with the caller, and the responsibility of freeing the new copy would lie with the text-index data-structure.

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.