[프로그래밍] Insertion Sort 시간측정 소스
- 최초 등록일
- 2003.06.09
- 최종 저작일
- 2003.06
- 2페이지/ C언어
- 가격 1,000원
소개글
랜덤으로 수를 생성해서 인서션소트를 하고 시간측정을 합니다
vc++로 스택사이즈 조절하면 100만개 돌아가는거 확인
목차
없음
본문내용
#include < stdio.h >
#include < stdlib.h >
#include < time.h >
#include < windows.h >
#define stack_size 1000000
//시간 측정을 위한 매크로
#define CHECK_TIME_START __int64 freq, start, end;if (QueryPerformanceFrequency((_LARGE_INTEGER*)&freq)){QueryPerformanceCounter((_LARGE_INTEGER*)&start);
// a는 double type milli second이고 b가 FALSE일때는 에러입니다
#define CHECK_TIME_END(a,b) QueryPerformanceCounter((_LARGE_INTEGER*)&end);a=(double)((double)(end - start)/freq*1000); b=TRUE;} else b=false;
double delaytime;
BOOL assert;
int shiftVac(long *E, long xindex, long x)
{
long vacant, xLoc;
vacant = xindex;
xLoc = 0;
while(vacant > 0) {
if(E[vacant-1] <= x) {
xLoc = vacant;
break;
}
E[vacant] = E[vacant-1];
vacant--;
}
return xLoc;
}
참고 자료
없음