pchero on November 30th, 2007

자바를이용하여 알기쉽게 merge-sort 알고리즘을 설명한 곳이 있다.  http://www.cse.iitk.ac.in/users/dsrkg/cs210/applets/sortingII/mergeSort/mergeSort.html

Continue reading about 자바로 설명된 merge sort 알고리즘

pchero on November 29th, 2007

 MAX 까지의 중복되지 않는 난수를 생성할때 이와 같은 방법을 사용한다. cnt = MAX;for (i = 0; i < MAX; i++)    n[i] = i;for (j = 0; j < loop_cnt; j++) {    swap(n[rand() % cnt], n[–cnt]);    printf(“%d”, n[cnt]);} 출처 : http://kldp.org/node/73442

Continue reading about 중복되지 않는 난수 생성 알고리즘

pchero on November 29th, 2007

 웹에서 설치 파일을 다운받았는데 *.bin 의 형식을 가지는 파일인 경우가 있다. (ex. GoogleEarth)  이와 같은 파일을 다운받고 설치를 시도하려는 경우, 해당파일에 실행권한(ex. 755) 을 준 다음에 터미널에서 실행을 시키면 정상적으로 설치가 시작된다.

Continue reading about bin 파일 실행법

pchero on November 28th, 2007

 fork() -> execl() 로 만든 자식 프로세스가 가끔씩 알수없는 이유로 동작이 정지되는 경우가 있다.  kill 시그널을 주거나 혹은 잘못된 명령을 전달했을때, 이를 처리하는 루틴이 없을 경우 이와 같은 현상이 발생한다.  ps -eal | grep ‘해당 프로세스 네임’  명령어를 입력하면 “defunct”이라는 상태 표시가 나온다.  이와 같은 ‘defunct’ 상태를 가진 프로세스를 ‘좀비 프로세스’라고 한다.  죽은 것도 아니요, […]

Continue reading about defunct 상태 발생시 대처법

pchero on November 28th, 2007

#include <stdio.h>#include <stdlib.h>#include <math.h> void queens(int i);bool promising(int i); int n;int *col; int main(){  printf(“Insert Number…n”); printf(“Insert : “); scanf(“%d”, &n);  col = (int *)malloc(n * sizeof(int)); queens(0);  return 0;} void queens(int i){ int j, tmp;  if(promising(i))  if(i == N) {   for(tmp = 1; tmp <= N; tmp++)    printf(“%d “, col[tmp]);   printf(“n”);  }  else   for(j = 1; j […]

Continue reading about N-여왕말 문제(되추적 알고리즘) 소스 코드