Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- BLUETOOTH
- CVE
- 코드게이트 주니어
- gogs
- openctf
- node
- Branch
- lob
- Hacking
- shellcraft
- node.js
- Codegate
- doorlock
- CODEGATE2018
- 노드 엑셀
- https설정
- 코드게이트
- https
- pwntools
- NGINX
- npm
- Git
- blueborne
- 도메인 https
- codegate2017
- xlsx
- gogs private git
- 코드게이트2017
- pwnable
- module
Archives
- Today
- Total
고졸백수해킹일기
삽입정렬 (insertion sort) 본문
#include<stdio.h>
void insertSort(int a[],int count){
int i,j,k,temp;
for(i=0;i<count;i++){
temp=a[i];
for(j=i-1;j>=0;j--){
if(temp>=a[j])
break;
a[j+1]=a[j];
}
a[j+1]=temp;
for(k=0;k<=i;k++)
printf("%d \t",a[k]);
printf("\n");
}
}
int main(void){
int arr[]={5,2,8,1,9,7};
int i,count;
count=sizeof(arr)/sizeof(int);
printf("정렬 전 데이터 : ");
for(i=0;i<count;i++)
printf("%d \t",arr[i]);
printf("\n");
insertSort(arr,count);
printf("정렬 후 데이터 : ");
for(i=0;i<count;i++)
printf("%d \t",arr[i]);
printf("\n");
return 0;
}
'코딩' 카테고리의 다른 글
popup을 이용한 data 전달 (0) | 2022.12.10 |
---|---|
flutter 오늘의 깨우침 (0) | 2021.09.18 |
flutter showDialog (0) | 2021.08.27 |
flutter 설치 시 --android-licenses 이슈 (0) | 2021.08.22 |
쉘 정렬 (shell sort) (0) | 2018.06.11 |