## Linked list :노드의 연결로 이루어진 자료구조

linked list 는 배열과 비교했을때 특정 데이터를 검색하는 시간이 오래 소유된다. index 를 통해서 찾는 배열과 달리 하나 하나 찾아봐야 하기 때문이다.

✓ 노드 추가
✓ 노드 삭제
두 자료를 보면 다음 요소의 주소를 알기 때문에 배열보다 요소를 추가하거나 삭제하기 쉽다. 하지만 다음요소의 주소만 알기 때문에 전에 있던 요소를 알수 없다.

단인 연결 리스트와 이중 연결 리스트로 존재한다.이중 연결 리스트다.addToTail(value) { let node = new Node(value); if(!this.head){ this.head = node; this.tail = node; } this.tail.next = node; this.tail = node; this._size ++ }
remove(value) { let find = this.head while(find) { if(find.value === value){ find.value = find.next.value find.next = find.next.next this._size -- } find = find.next } }
getNodeAt(index) { let count = 0; let find = this.head while(find){ if(count === index){ return find } find = find.next count++ } return undefined }
contains(value) { let find = this.head while (find){ if(find.value === value){ return true; } find = find.next } return false; }
indexOf(value) { let count = 0; let find = this.head while(find){ if(find.value === value ){ return count } find = find.next count++ } return -1 }
size() { if(this._size < 1){ return } return this._size }