Data Structures PJ1
- 최초 등록일
- 2012.12.01
- 최종 저작일
- 2011.04
- 16페이지/ 한컴오피스
- 가격 3,000원
소개글
연세대학교 데이타구조 플젝입니다. 만점받았습니다
목차
(1) Brief explanation of the problem
(2) Your view as to how it ties in with what we covered in class
(3) Discussion of your result
(4) Short explanation of your code
(5) Your code
본문내용
(1) Brief explanation of the problem
The goal of the problem is to find accurately the value of S(42) which we already found but we did not find because of overflow. We can find the value of S(42) by using linked list because each list has a number. Before finding the value of S(42), we should make some functions. One of them is a function which makes linked list when arbitrary numbers are given. The others are addition function and multiple function. The addition function can perform sum of linked lists. And the multiple function can perform multiplication of linked lists. Since Fiboritorial function is composed of addition and multiplication, we should the functions. By using linked list, we can avoid overflow. After I make the functions, I should make Fiboritorial functions by using recursive.
<중 략>
newnode=(list*)malloc(sizeof(list));
newnode->number=-1;
newnode->next=ad1;
newnode->prev=ad2;
ad1->prev=newnode;
ad2->next=newnode;
while(head3->prev!=NULL){
head3=head3->prev;
}
head10=head3;
/*다시 점을 추가해주기 위한 알고리즘. ad1은 점이 추가될 list의 오른쪽편(next) 주소이고
ad2은 점이 추가될 왼쪽편(prev)의 주소이다.
*/
}
return head10;
}
/*fibo_function이 더하기와 곱하기로 이루어졌으므로 add_function과 mul_function을 이용하기만 하면된다
단 list를 만들때 char로 만들었기때문에 n(임의의수)를 itoa로 이용하여 char로 바꾼다.
참고 자료
없음