728x90
300x250
[자료구조(Data Structure)] - 2. Insertion Sort
[슈도코드]
void insertsort(int *arr, int n)
{
int i = 1;
int j ;
int temp ;
while ( i < n )
{
temp = arr[i] ;
j = i - 1;
while ( j >= 0 && ( temp < pArr[ j ] ) )
{
pArr [ j + 1 ] = pArr[ j ] ;
j-- ;
}
pArr [ j + 1 ] = temp ;
}
}
반응형
'공부(Study) > 자료구조(Data Structure)' 카테고리의 다른 글
[자료구조(Data Structure)] - 6. Linked Queue (10) | 2015.04.26 |
---|---|
[자료구조(Data Structure)] - 5. Circular Queue with Array (10) | 2015.04.26 |
[자료구조(Data Structure)] - 4. Circular Linked List - Java (11) | 2015.04.25 |
[자료구조(Data Structure)] - 3. Huffman Tree (10) | 2014.12.29 |
[자료구조(Data Structure)] - Partition 기법 - QuickSort (10) | 2014.10.09 |