Giter Club home page Giter Club logo

ds's Introduction

๐Ÿ”— Data Structures and Algorithms

Build Status Build status Coverage Status Codacy Badge

This library provides common data structures. It will also provide some data structures which needed in render or game engines. In the future I'll try to optimize memmory access.

There may multiple way to implement a data structure but I tried to implement best way to do that. For instance Red-Black Trees are only implemented as top down insertion/deletion to make it faster.

There are some convenient constructors for common use cases. For instance rb_newtree_str() creates new rb-tree that uses strings as key, rb_newtree_ptr() creates new rb-tree that uses pointers as key. When you use these functions to alloc a data structure then you don't need to provide compare or print functions.

This library prodives allocator api so you can override default allocator.

Usage

#include <ds/rb.h> // Red-Black Tree

int
main(int argc, const char * argv[]) {
  RBTree *tree;
  /* ... */

  /* use string keys */
  tree = rb_newtree_str();

  rb_insert(tree, "key", value);

  /* ... */
  value = rb_find(tree, "key");

  rb_destroy(tree);
}

Todo

  • rbtree
    • top-down insertion
    • top-down deletion
  • forward-list
    • forward-list-separate (reduces FList struct)
  • hash-table
    • builtin hash functions e.g. djb2
    • resizing hash table
  • quick sort implementation for float, double, i32, u32, i64, u64
  • queue (working on this)
  • stack
  • binary heap / priority queue
  • dynamic array
  • octree
  • quadtree
  • kd-tree
  • bvh
  • b-tree

Build

Unix (Autotools)

$ sh autogen.sh
$ ./configure
$ make
$ make check # [Optional]
$ [sudo] make install # [Optional]

Windows (MSBuild)

Windows related build, project files are located in win folder, make sure that you are inside in the libds/win folder. Code Analysis are enabled, it may take awhile to finish build

$ cd win
$ .\build.bat

if msbuild didn't work then you can try to build it with devenv:

$ devenv libds.sln /Build Release

License

MIT. check the LICENSE file

ds's People

Contributors

recp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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