일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
- Branch
- 코드게이트 주니어
- xlsx
- gogs private git
- node
- npm
- Codegate
- BLUETOOTH
- module
- 도메인 https
- 노드 엑셀
- Hacking
- NGINX
- pwntools
- node.js
- shellcraft
- lob
- 코드게이트2017
- codegate2017
- https설정
- Git
- doorlock
- 코드게이트
- blueborne
- pwnable
- https
- CODEGATE2018
- openctf
- CVE
- gogs
- Today
- Total
고졸백수해킹일기
쉘 정렬 (shell sort) 본문
#include<stdio.h>
void shellSort(int a[],int n){
int i,j,k,m=0,t;
int tmp;
for(t=n/2;t>0;t/=2){
for(i=t;i<n;i++){
tmp=a[i];
for(j=i;j>=t;j-=t){
if(tmp<a[j-t]){
a[j]=a[j-t];
}
else
break;
a[j]=tmp;
}
}
printf("step %d :",++m);
for(k=0;k<n;k++)
printf("%d \t",a[k]);
printf("\n");
}
}
void main(){
int arr[]={2,5,8,1,9,7,3,10};
int i,c;
c=sizeof(arr)/4;
printf("정렬전 데이터 : ");
for(i=0;i<c;i++)
printf("%d \t",arr[i]);
printf("\n");
shellSort(arr,c);
printf("정렬 후 데이터 : ");
for(i=0;i<c;i++)
printf("%d \t",arr[i]);
printf("\n");
}
'코딩' 카테고리의 다른 글
popup을 이용한 data 전달 (0) | 2022.12.10 |
---|---|
flutter 오늘의 깨우침 (0) | 2021.09.18 |
flutter showDialog (0) | 2021.08.27 |
flutter 설치 시 --android-licenses 이슈 (0) | 2021.08.22 |
삽입정렬 (insertion sort) (0) | 2018.06.11 |