Code Monkey home page Code Monkey logo

c_data_structures's Introduction

INFO

  • This is a C repository containing a curated set of data structures and algorithm.website
  • The data structures are implemented keeping them Generic and Abstract.
  • Genericness: Since in C any data structure is completely type dependent, we've tried to achieve a genric data structure that supports any standard data types (int, char, float, etc..) and user defined data types (struct user {})
    • The means by which we achieved a data structure by storing the pointer to the data (std or user defined) rather the data itself
    • Given below is a snippet of code explaining the same,
// Link list node definition
typdef void* t_gen;                     //< Generic data pointer

typedef struct llnode {
        t_gen data;                     //< Pointer to the data to be stored in link list
        struct llnode *nxt;             //< Pointer to next node in list
        struct llnode *prv;             //< Pointer to prev node in list
} t_llnode;
  • Abstractness: The operations/procedures for each data structure is abstracted to the user by using function pointers, thus creating a psuedo class like structure
t_linklist *l;
t_dparams dp;

// Data type specific operations to be given to data structure
init_data_params(&dp, eSTRING);

// Create a string XOR link list
l = create_link_list("STRING XORLL",eXOR_LINKLIST, &dp);


// Add elements to linklist
l->add(l, "Hello");
l->add(l, "World");

// print linklist
l->print(l);

// Destroy linklist
l->destroy(l);

LIST OF DATA STRUCTURES

ALGORITHMS

  • Searching

    • Linear Search
    • Binary Search
  • Sorting

    • Insertion Sort
    • Selection Sort
    • Bubble Sort
    • Quick Sort
    • Merge Sort
    • Heap Sort
  • Graph Algorithms

    • Dijkstra's Shortest Path
    • Bellman Ford Shortest Path
    • Prim's Minimum Spanning Tree
    • Kruskal's Minimus Spanning Tree

Code Documentation

CONFIGURE

Create a folder called bin inder the following directories ds/, common/ and test/

Def.make change flags

BUILD

$ make clean; make all

TEST

Test case are as defined in test/src/test.c

RUN

$ ./foo.out

c_data_structures's People

Contributors

blindcentaur avatar jar3m avatar rama2092 avatar ranganathvn avatar srjsrini avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

c_data_structures's Issues

Logging Management

Defining Log Levels
Console and File based logging enabled
Enabling log Levels from defs.make

Assertion/Fault Management

Assertion managent
Error handling
Fault handling
Signal handling
Saving state before exiting the due to faulty code

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.