Skip to content

Latest commit

 

History

History
79 lines (55 loc) · 3.68 KB

File metadata and controls

79 lines (55 loc) · 3.68 KB

macro generic data structures

Projec Logo

Table of Contents

  1. Getting Started
  2. Using the library
  3. Running examples

Getting Started

Project "c-language-data-structures" has come as an idea to supply C Language with some basic generic data structures, as follows:

Content/documentation Header/Source Macro File
AVL Tree m_avl.h
Binary Search Tree m_bst.h
Config File (Basic Utils for Error Handling) m_config.h
Double Linked List m_dlist.h
Single Linked List m_list.h
Priority Queue m_pqueue.h
Queue m_queue.h
Red Black Tree m_rbk.h
Stack m_stack.h

Every single data structure from this project can be used in any scopes and with different data types, however you must follow a set of rules so you don't break the program. Every set of rules for every data structure can be found in documentation folder from current project.

I tried for every known object to keep their function definitions as in C++ and also followed the standard naming of methods according to specific data structure.

It is very important not to use directly the members of the structure objects, however if you feel safe to access them by yourself there should be no problem.

Dependencies

  • Linux, MacOS or WSL System
  • GCC Compiler

Using the library

The only thing is to copy the header file of the desired data structure into your project into a specified directory, then to add to a file by:

  #include "/path/to/file/m_avl.h" // or any other m_name.h

As you may have observed all the methods return a merr_t type, which is used for error handling.

  // For example
  M_OK - when the method executed successfully
  M_NULL_INPUT - when the input is null
  ...

  // In order to get a message for any error you have to call the macro

  merr_t err = function_from_library(of_some_input);

  if (err != M_OK) {
    MERROR(err); // Which will print to stderr the error and the meaning of it
  }

Running examples

Some data structures have some examples for you to undestand what you should and what you should not. Also the examples will show you some untraditional ways to solve some things. In every example folder for different data structure exists one source file that will be a benchmark to test the power of data structures on your system. The benchmarks can run a little slow depending on your system.

For examples how to build and how to run the examples you must read the documentation related to the examples section. The link to documentation HERE.

Make sure after you are done with one data structure exaxmple to run:

    make clean