본문 바로가기
반응형

전체 글108

[알고리즘] 쿼드트리 (Quad Tree) 쿼드트리 (Quad Tree) 8x8 quad tree를 압축하는 경우 아래와 같이된다. Flow는 아래와 같다. S(Size) Start X:0, Y:0 S:8 -> x:0, y:4 break, "(" 출력 Q1 X:0, Y:0 S:4 -> x:2, y:0 break, "(" 출력 Q1 X:0, Y:0 S:2 -> return, 1 출력 Q2 X:2 Y:0 S:2 -> return, 1 출력 Q3 X:0 Y:2 S:2 -> return, 0 출력 Q4 X:2 Y:2 S:2 -> x:2 y:3 break, "(" 출력 Q1 X:2 Y:2 S:1 -> return, 0 출력 Q2 X:3 Y:2 S:1 -> return, 1 출력 Q3 X:2 Y:3 S:1 -> return, 0 출력 Q4 X:3 Y:3 S.. 2018. 7. 31.
[개발환경] git 사용하기 git 사용하기 (install & .gitconfig) git install sudo apt-get install git-core .gitconfig 설정 vi ~/.gitconfig [user] name = minyunhong email = yunhong6183@naver.com [color] ui = auto [color "diff"] meta = yellow bold frag = magenta bold old = red bold new = green bold whitespace = red reverse [color "branch"] current = red bold local = green bold remote = cyan bold [push] default = simple [alias] br =.. 2018. 7. 29.
[개발환경] ubuntu chome 설치 ubuntu chome 설치 ubuntu 32bit 기준 wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb sudo apt-get in sudo apt-get install libxss1 libgconf2-4 libappindicator1 libindicator7 sudo dpkg -i google-chrome-stable_current_amd64.deb ubuntu chome 삭제 sudo dpkg -r google-chrome-stable ubuntu 64bit 기준, 아래 url에서 다운로드 하여 설치하면 된다. https://google-chrome.kr.uptodown.com/ubuntu/download/.. 2018. 7. 29.
[개발환경] vi(vim) 설치 및 vimrc 설정 vi(vim) 설치 sudo apt-get install vim vimrc 설정 " Syntax Highlighting " indent set autoindent set cindent " line number set nu " table stop(Tab) set ts=4 " auto indent set shiftwidth=4 " status bar always on set laststatus=2 " 검색어 highlight set hlsearch " scroll bar set scrolloff=2 " 일치하는 괄호 highlight set showmatch if has(“syntax”) syntax on endif 2018. 7. 29.
[개발환경] bashrc 설정 bashrc 설정 alias m='sudo mount -t vboxsf share share' alias ..='cd ../' alias ...='cd ../../' alias ....='cd ../../../' alias l='ls -al' alias gc='gcc -o hong.out' alias f='find -name' 2018. 7. 29.
[알고리즘] 계수 정렬(Counting sort) 계수 정렬(Counting sort) #include #include #define MAX_NUMBER 10000 int main() { int maxnum =0, i = 0; int *arr = NULL, *sort = NULL, *cnt = NULL; scanf("%d", &maxnum); arr = (int*)calloc(maxnum, sizeof(int)); sort = (int*)calloc(maxnum+1, sizeof(int)); cnt = (int*)calloc(MAX_NUMBER, sizeof(int)); //입력. for(i=0; i 2018. 6. 11.
[cmake] cmake 사용법 cmake 사용법을 정리한다. cmake 설치 명령어. sudo apt-get install cmake cmake 버전 확인. cmake --version Compile Option 추가는 아래와 같이 할 수 있다. add_definitions(-DINCLUDE_HONGTEST) cmake 작성. (main.c 파일 compile, binary 파일 hongStudy) #cmake minimum version cmake_minimum_required(VERSION 3.5.1) #compiler set(CMAKE_C_COMPILER "gcc") #binary name set(BIN_NAME hongStudy) #compile option add_definitions(-DINCLUDE_HONGTEST) #s.. 2018. 5. 31.
[C언어] 웹 정보 가져오기 웹 정보 가져오기 #include #include #include #include int main(void) { if( access("/tmp/hong.html", F_OK) == 0 ) system("rm -rf /tmp/hong.html"); system("wget -P /tmp -O /tmp/hong.html http://hong00.tistory.com"); FILE *fp = NULL; fp = fopen("/tmp/hong.html", "r"); if( fp != NULL ) { char temp[255] = ; char *pstr = NULL; while( !feof(fp) ) { pstr = fgets( temp, sizeof(temp), fp ); printf("%s\n", temp); .. 2018. 5. 14.
[알고리즘] 퀵 정렬(Quick sort) 퀵 정렬(Quick sort) quick 정렬의 source code이다. C에서 기본으로 제공하는 qsort는 아래와 같은 원리도 동작한다. #include #include void swap(int* a, int* b) { int temp = *a; *a = *b; *b = temp; } int quickSort(int* arr, int left, int right) { int L = left, R = right; int pivot = arr[(left + right)/2]; do { while( arr[L] pivot ) R--; if( L 2018. 5. 14.
728x90
반응형