[자료구조]링크드 리스트 c언어 소스코드
- 최초 등록일
- 2013.07.29
- 최종 저작일
- 2012.06
- 7페이지/ 압축파일
- 가격 1,000원
소개글
자료구조에서 나오는 링크드 리스트(linked list) 소스코드입니다.
insert와 delete 구현되어 있습니다.
A+ 맞은 자료입니다.
목차
1.The followingfunctions are the insertion and the deletion operation. Assume that the list has 3 elements and head and pnodeis given as the figure below. Draw the memory status for every line of the functions.
2. Implement the following functions for singly linked list without head node.
3. 소스코드 첨부
본문내용
typedef struct node Node ;
struct node {
int data ;
Node* llink, rlink
} ;
void dinsert(Node* pnode, int value) {
Node* newnode = malloc( sizeof(Node) ) ;
newnode ->data = value ;
newnode->llink = pnode;
newnode->rlink = pnode->rlink;
pnode->rlink->llink = newnode;
pnode->rlink = newnode;
}
<중 략>
else
{
for(i=1;i<pos-1;i++) //cur 노드를 해당 위치직전 위치로 이동
{
cur=cur->link;
}
temp=cur->link; //temp포인터가 해당 위치의 노드를 가리키게 함.
cur->link=temp->link; //해당 노드를 제외한 양쪽 두 노드를연결
free(temp);
}
참고 자료
없음
압축파일 내 파일목록
linked_list.c
linked_list.hwp