This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| typedef int s32; | |
| typedef unsigned int u32; | |
| typedef unsigned long long u64; | |
| typedef float f32; | |
| typedef double f64; | |
| #define ARRAY_COUNT(Array) (sizeof(Array)/ sizeof(Array[0])) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "array.h" | |
| array_int array_int_create(size_t n) | |
| { | |
| array_int a; | |
| if(n < 1) n = 1; | |
| int* mem_pool = (int*) malloc(sizeof(int) * n); | |
| if(mem_pool == NULL) | |
| { | |
| printf("init vector malloc failed...\n"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "ids.hpp" | |
| /*ids.hpp defines the global inline variables of each objects ID*/ | |
| #include <unordered_map> | |
| #include <vector> | |
| #include <iostream> | |
| typedef struct Vertex Vertex ; | |
| typedef struct Link Link ; | |
| typedef struct Edge Edge ; | |
| typedef struct Graph Graph ; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //------------------- Bezier Curve implementation --------------------------// | |
| //------------------- This App Needs SDL and SDL_Image library to run -----// | |
| //------------------- The Algorithm itself is inside drawCurve function --// | |
| //------------------- A demo of the app is at: | |
| //------------------- https://streamable.com/687dmw --------------------// | |
| #include "src/core.h" | |
| #include <SDL.h> | |
| #include <SDL_image.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| '''Method one using tree traversal''' | |
| def parentheses(depth,count=0,acc='',full=None): | |
| if full is None: | |
| full = [] | |
| if count > 0: | |
| parentheses(depth,count-1,acc+')',full) | |
| if depth > 0: | |
| parentheses(depth-1,count+1,acc+'(',full) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #define START_LINE_SIZE 4 | |
| #define MAX_WORDS_PER_LINE 20 | |
| #define MAX_WORD_SIZE 256 | |
| typedef struct words_t | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "linkedliststr.h" | |
| #include <stdlib.h> | |
| #include <stdio.h> | |
| #include <string.h> | |
| linked_list_str_t* CreateLinkedListStr(char* key) | |
| { | |
| linked_list_str_t* temp = malloc(sizeof(linked_list_str_t)); | |
| temp->head = malloc(sizeof(StrNode)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "stack.h" | |
| #include "validbracket.h" | |
| #define STACK_MAX_SIZE 100 | |
| int main(int argc, char **argv) { | |
| if (argc != 2) { | |
| printf("usage:\nProvide a single argument as a string for bracket matching " | |
| " program\n"); | |
| return 0; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <assert.h> | |
| #include <stdbool.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #define STACK_MAX_SIZE 10000 | |
| typedef struct mystack_t { | |
| unsigned int SP; | |
| unsigned int size; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "hashtable.h" | |
| int Hash(char* key, ulong_t seed) | |
| { | |
| ulong_t h = seed; | |
| // this function is copied from stack over flow https://stackoverflow.com/a/629127 | |
| while (*key) | |
| { | |
| h = h * 101 + (unsigned)*key++; |
NewerOlder