배열과구조
- 최초 등록일
- 2001.01.13
- 최종 저작일
- 2001.01
- 29페이지/ 한컴오피스
- 가격 1,000원
목차
배열과구조 강의자료임돠
본문내용
void fast_transpose(term a[], term b[])
{
/* a를 전치시켜 b에 저장 */
int row_terms[MAX_COL], starting_pos[MAX_COL];
int i,j, num_col = a[0].col, num_terms = a[0].value;
b[0].row = num_cols; b[0].col = a[0].row;
b[0].value = num_terms;
if (num_terms > 0) { /* 0이 아닌 행렬 */
for(i = 0; i < num_cols; i++)
row_terms[i] = 0;
for(i = 1; i <= num_terms; i++)
row_terms[a[i].col]++;
starting_pos[0] = 1;
for(i = 1; i < num_cols; i++)
starting_pos[i] =
starting_pos[i-1] + row_terms[i-1];
for(i = 1; i <= num_terms; i++) {
j = starting_pos[s[i].col]++;
b[j].row = a[i].col; b[j].col = a[i].row;
b[j].value = a[i].value;
}
}
}
참고 자료
없음