Posts

Showing posts from April, 2022

Tuple with get element feature

/******************************************************************************   New Era Datastructure    Designed by Daipayan Bhowal *******************************************************************************/ #include <stdio.h> #include <stdlib.h> #include <stdarg.h> #include <string.h> typedef enum Type {   CHAR,   INT,   FLOAT,   DOUBLE,   SHORT,   LONG,   LONG_LONG,   STRING }type_t; typedef struct Tables {    int index;    int type[64];    void * args[64];    char max_index; } tables; typedef tables* table_t; table_t itable(int num,...) // init_table {    va_list valist;    va_start(valist, num);    static int counter =0;    table_t t = (table_t)malloc(sizeof(tables));    t->index= ++counter;     for(int j=0; j< num; j++)     {        ...

Tuple(itable) with String support

 /******************************************************************************   New Era Datastructure     by Daipayan Bhowal *******************************************************************************/ #include <stdio.h> #include <stdlib.h> #include <stdarg.h> #include <string.h> typedef enum Type {   CHAR,   INT,   FLOAT,   DOUBLE,   SHORT,   LONG,   LONG_LONG,   STRING }type_t; typedef struct Tables {    int index;    int type[64];    void * args[64];    char max_index; } tables; typedef tables* table_t; table_t itable(int num,...) // init_table {    va_list valist;    va_start(valist, num);    static int counter =0;    table_t t = (table_t)malloc(sizeof(tables));    t->index= ++counter;     for(int j=0; j< num; j++)     {          ...

Tuple (itable)

 /******************************************************************************   New Era Datastructure     by Daipayan Bhowal *******************************************************************************/ #include <stdio.h> #include <stdlib.h> #include <stdarg.h> typedef enum Type {   CHAR,   INT,   FLOAT,   DOUBLE,   SHORT,   LONG,   LONG_LONG }type_t; typedef struct Tables {    int index;    int type[64];    void * args[64];    char max_index; } tables; typedef tables* table_t; table_t itable(int num,...) // init_table {    va_list valist;    va_start(valist, num);    static int counter =0;    table_t t = (table_t)malloc(sizeof(tables));    t->index= ++counter;     for(int j=0; j< num; j++)     {          t->type[j] = va_arg(valist, type_t); ...

String library

  #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct string {   int len;   char *str;   char *back;   char empty; } string_type; typedef string_type* string_t; typedef struct mem {   string_t str;   int string_size;   int index; } memrecord; string_t string(char *s) {   int len=strlen(s);   char *content=(char *)malloc(len+1);   memcpy(content,s,len);   content[len] = '\0';   string_t st = (string_t) malloc(sizeof(string_type));   st->len = len+1;   st->str = content;   st->back = content + len - 1;   if(strcmp(s,"\0"))     st->empty = 1;          return st; } #define empty(st)   if(st->len == 0)                \                   ...

Generic datatype

 /******************************************************************************                             New-Era Datastructure                               by Daipayan Bhowal *******************************************************************************/ #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct GenType {   char size;   void *payload; } generic; typedef generic* general_t; typedef enum ty {     INT,     CHAR,     SHORT,     FLOAT,     DOUBLE,     LONG,     LONG_LONG,     STRUCT }type_t; #define asg(data) assign(&data,siz...

BST Tree using dynamic array

/******************************************************************************                         New Era Datastructure                       Designed by Daipayan Bhowal *******************************************************************************/ #include <stdio.h> #include <stdlib.h> #include <string.h> int SIZE = 64; // set default size of dynamic array as 64 enum type_t {     INT,     FLOAT,     CHAR,     STRING,     STRUCT }; int get_size_type(enum type_t t, int struct_size) {     int mulitplier;      switch(t)     {       case INT:         mulitplier = size...

Dynamic Array with structure support

 /******************************************************************************                         New Era Datastructure                       Designed by Daipayan Bhowal *******************************************************************************/ #include <stdio.h> #include <stdlib.h> #include <string.h> int SIZE = 64; // set default size of dynamic array as 64 enum type_t {     INT,     FLOAT,     CHAR,     STRING,     STRUCT }; int get_size_type(enum type_t t, int struct_size) {     int mulitplier;      switch(t)     {       case INT:         mulitplier ...

Dynamic Array

 /******************************************************************************                         New Era Datastructure                       Designed by Daipayan Bhowal *******************************************************************************/ #include <stdio.h> #include <stdlib.h> #include <string.h> enum type_t {     INT,     FLOAT,     CHAR,     STRING }; int get_size_type(enum type_t t) {     int mulitplier;      switch(t)     {       case INT:         mulitplier = sizeof(int);       break;          ...

Dynamic Stack Optimized

 /******************************************************************************                         New Era Datastructure                       Designed by Daipayan Bhowal *******************************************************************************/ #include <stdio.h> #include <stdlib.h> #include <string.h> struct dyna_stack {     void *data;     struct dyna_stack* down; }; struct dyna_stack* top=NULL; enum type_t{   INT,   CHAR,   STRING,   FLOAT }; int type(enum type_t t,void *data) {     size_t size;       switch(t)        {            case INT:            {  int *i = (int*) data;   ...

Dynamic Stack

#include <stdio.h> #include <stdlib.h> #include <string.h> struct dyna_stack {     void *data;     struct dyna_stack* down; }; struct dyna_stack* top=NULL; enum type_t{   INT,   CHAR,   STRING,   FLOAT }; void push(enum type_t t,void* data) {       size_t size;         switch(t)        {            case INT:            {  int *i = (int*) data;              size= sizeof(int);            break;            }            case CHAR:            {                  char* c = (char*) data;              size= sizeof(char);            break;     ...

Simple projects

 functhor --> function searcher, backtraces, variable values saved inside a map Writing a C++ program to divide a program by function, each function will be saved as an file/object and header files auto generated from function definition. Write a C program to implement a AST using an array, AST structure body will be serialized string/pointer. Write a C++ program to find the memory top allocators and memory corruption framework. Write a C++ program to implement dynamic stack, queue ,  binary tree as an array, dynamic tuple data structure. Write a C program to design an IPC using file , file will act as a storage place, consumer-producer solution using file. (Filo) Write a C program to design set and dictionary. Write a C program to implement string datatype of C++. functionalities like string constructor, string copy, string concatenate etc. Write a C++ program to add/divide/subtract/multiply/lshift/rshift 2 string numbers. Write a C++ program for memory allocator from sc...

complex datastructure

 Dynamic stack Binary tree as array i-> 2*i(left-child)                                 i-> 2*(i+1) (right-child) string pool shared memory (mmap) zero copy Hugepages file as a datastructure function as an object/file or JIT for functions sequential string box as a datastructure (linked list encapsulated) Software as Complex Datastructure ------------- DPDK Rabbit MQ Protocol buffers/Apache Kafka Redis Kubernetes Docker NGINX FileBeat Graffana Prometheus ELK d-Bus   REST API Apache Cassandra Memcached OpenShift