Giter Club home page Giter Club logo

abstract-data-types's Introduction

Abstract Data Types in C

This is a modern C library containing implementations designed to provide fast and efficient data structure operations for a wide range of applications while also being educational, having a relatively non-challenging code to follow. All ADTs have been implemented using void pointers to make them generic, allowing the same code to handle different data types (eg integers, strings, structs, etc). The library contains the following ADTs:

The source code of every ADT can be found over at the modules directory.

Usage

The library can be used in your C project by following 3 (simple) steps.

Step 1

Include the header file of the ADT library

#include "lib/ADT.h"

or just include the desired header file(s) of the data structure(s) you want to use.

#include "vector.h"
#include "RedBlackTree.h"
#include "stack.h"
#include "pq.h"
#include "hash_table.h"

Step 2

Depending on the ADT, provide a number of the following functions upon its creation:

  • Destroy function
    Destroys the data allocated for the elements.

  • Compare function
    Compares two Pointers a and b, and returns < 0 if a < b, 0 if a = b or > 0 if a > b.

  • Hash function
    Takes a Pointer and returns a unsigned integer (Used by the hash table).

  • Visit function
    Visits a vertex (Used by the graph).

Step 3

Use ADTlib.a on compilation.

~$ gcc -o my_prog_exec my_prog.c -L. lib/ADTlib.a

Tests

The library comes with a comprehensive suite of tests covering the ADT's, using the acutest library. The tests are located in the tests directory, and are designed to ensure that the library functions as expected. In order to test a certain ADT, navigate to the directory and simply execute:

~$ make run ADT=<ADT>

abstract-data-types's People

Contributors

pavlosdais 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

Watchers

 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.