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> | |
| //http://stackoverflow.com/questions/101439/the-most-efficient-way-to-implement-an-integer-based-power-function-powint-int | |
| /* | |
| all exponential values (e.g.5) was chaged to 2 system | |
| * check even or odd | |
| <-----------------------> | |
| 2^3 2^2 2^1 2^0 | |
| 0b 1 0 1 0 : 10 |
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> | |
| #define MAX 50 | |
| int a[] = { 99, 11, 29, 44, 17, 55, 63, 05, 22, 42, 15, 12 ,21 }; | |
| int b[MAX]; | |
| int merge_merging(int src[], int dst[], int start, int mid, int end) | |
| { |
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> | |
| /* | |
| refer to | |
| https://en.wikipedia.org/wiki/Breadth-first_search | |
| */ | |
| #define MAX_VERTEX 30 | |
| int visit[MAX_VERTEX]={0}; | |
| int map[MAX_VERTEX][MAX_VERTEX]={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 <stdio.h> | |
| #include <string.h> | |
| #define MAX_HASH 20 | |
| #define HASH_KEY 0 | |
| #define HASH_VAL 1 | |
| static int hashmap[MAX_HASH][2]={0}; // open-addressing hash, pointer | |
| static int hashsize=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 <stdio.h> | |
| int *aa[10]={0}; | |
| int (*bb)[10]={0}; | |
| int cc[10]; | |
| /* | |
| Output | |
| *aa[10]=40 byte (*bb)[10]=4 byte cc[10]=40 byte | |
| */ |
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> | |
| typedef struct sListElemt_{ | |
| int data; | |
| struct sListElemt_ *next ; | |
| }sListElemt; | |
| typedef struct sList_{ | |
| 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 <stdio.h> | |
| #define CNT_TEST 2 | |
| int map[20]={0}; // save address info | |
| int size=0; | |
| int map2[20]={0}; // save address info | |
| int size2=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 <stdio.h> | |
| /* | |
| refer to | |
| http://www.thecrazyprogrammer.com/2014/03/depth-first-search-dfs-traversal-of-a-graph.html | |
| */ | |
| #define MAX_MAPSIZE 50 | |
| #define SET_UNDIRECTIED_GRAPH | |
| int map[MAX_MAPSIZE][MAX_MAPSIZE]={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 <stdio.h> | |
| //refer to https://ko.wikipedia.org/wiki/%ED%9E%99_%EC%A0%95%EB%A0%AC | |
| #define heap_parent(n) ((n-1)/2) | |
| #define heap_left(n) ((2*n)+1) | |
| #define heap_right(n) ((2*n)+2) | |
| typedef enum{ | |
| SET_HEAPNULL=0, | |
| SET_UPHEAP, |
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 <string.h> | |
| int getStrlens(char str[]) | |
| { | |
| int cnt=0; | |
| while(str[cnt] !='\0') | |
| cnt++; | |