728x90

Array의 정의(Definition of Array)

Array는 순차적인 item의 집합이다. 또한, Array는 해당 item마다 index를 갖는다.

Array의 이미지화

 

List의 정의(Definition of List)

List는 순차적으로 정렬된 item(=node)의 집합이다. List는 index를 갖지 않는다.

List의 이미지화

 

👓 Array와 List의 차이

1. Item에 직접(direct) 또는 순차적(sequential)으로 접근할 수 있느냐?

Array는 직접적 또는 순차적 방법으로 모두 item에 접근할 수 있지만,
List는 순차적으로 접근하는 것만 가능하다.
List는 memory에 저장되기 때문이다.

2. List는 index가 없다.

1번과 비슷한 말이지만, 조금 더 설명하기 위해 2번을 추가하였다.
List는 index가 없다. 왜냐하면 Array의 item들처럼 꼭 바로 옆에 item을 할당할 필요가 없기 때문이다.
List의 Node(item)은 다음 값을 가리키는 주소(pointer)를 가지고 있기 때문에 memory의 어느 위치에 있어도 상관 없다.

여러 글을 읽어보았지만, 아래 출처 내용에 동의한다. 그리고 다른 의견도 많지만, 간단히 글을 작성해본다. (사실 번역이다)
List의 대표적 예인 Linked List가 궁금하다면 JavaScript - Data Structure 카테고리를 참고하길 바란다.

👍 출처 https://www.quora.com/What-is-the-difference-between-an-ARRAY-and-a-LIST

 

What is the difference between an ARRAY and a LIST?

Answer (1 of 17): Arrays > An array is an ordered collection of items, where each item inside the array has an index. Taking the one dimensional array one step further, we can have arrays with two (or even more) dimensions. Lists > It’s a collection of ite

www.quora.com

 

+ Recent posts