동작합니다. 리스트의 인덱스를 활용하는 연산은 시작 또는 끝부터 리스트를 순회합니다. 이때 어느 것이든
특정 인덱스에서 가까운 것을 선택합니다.
이중 연결 리스트를 잘 모른다면
http
://
thinkdast
.
com
/
doublelist
를 참고하거나 요약한 다
음 내용을 확인하세요.
●
각 노드는 다음 노드와 이전 노드에 대한 참조를 포함합니다.
●
LinkedList
객체는 첫 번째와 마지막 요소에 대한 참조를 포함합니다.
따라서 리스트의 어느 한쪽 끝에서 시작하여 어느 방향으로든 순회할 수 있습니다. 결과적으로
상수 시간으로 리스트의 시작과 끝에 요소를 추가하고 삭제할 수 있습니다.
다음 표는
ArrayList
와
MyLinkedList
(단일 연결)
,
LinkedList
(이중 연결)
클래스에서 기대하
는 성능을 요약해서 보여줍니다.
구분
ArrayListMyLinkedListLinkedList
add(끝)1n1
add(시작)n11
add(일반적으로)nnn
get/set1nn
indexOf/lastIndexOfnnn
isEmpty/size111
remove(끝)1n1
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.
O’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
I wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
I’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
I'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.