강의

멘토링

커뮤니티

Inflearn Community Q&A

gwisej68's profile image
gwisej68

asked

Jeong Hye-kyung Fantastic Data Structure in C

Lecture 12. Implementing Doubly Linked List 1 (Creation, Addition, Output, Search)_Textbook/Practice files attached

음...

Written on

·

402

0

addfirst 랑 addlast 를 왜 나누는지 이해가 안됩니다.

addlast 코드만 있어도 추가하는데는 문제가 없어보이는데...

c

Answer 1

1

lectopia1님의 프로필 이미지
lectopia1
Instructor

addfirst()함수는 새노드를 헤드노드 바로뒤에 추가하고
addlast()함수는 새노드를 테일노드 바로 앞에 추가합니다.

즉, addfirst()함수로 A B C 순서로 노드를 추가하고 출력해보면 A B C순으로 출력되고
addlast()함수로 A B C 순서로 노드를 추가하고 출력해보면 C B A순으로 출력된답니다.

gwisej68's profile image
gwisej68

asked

Ask a question