java
-
[자료구조] BST - 이진탐색 트리(Binary Search Tree)코딩(Coding)/자료구조 2021. 1. 7. 11:04
이진 탐색 트리 BST(Binary Search Tree) BST는 각각의 Node가 2개의 하위 노드를 가진 모양의 Tree이다. 단 BST는 정렬된 상태로 Node가 저장된다. 즉 순서가 있다는 것이다. 쉽게 이야기 하자면 특정 노드가 있을때 그 노드의 왼쪽 하위 노드는 해당 노드보다 data값이 작아야하며 반대로 오른쪽 하위 노드는 data값이 해당 노드보다 커야한다. 그림을 통해 확인해 보면 위 그림을 확인해 보자 root노드인 50의 왼쪽 node의 data 값은 30이고 오른쪽 노드의 data값은 90이다. 해당 규칙을 지키며 tree를 구성한 것이 BST이다. 설계 그렇다면 바로 구현을 시작해보자 Node 설계 우선은 Tree의 각각의 노드를 설계할 것이다. 그림에서 처럼 좌우의 하위 Nod..
-
[자료구조] Doubly Linked List코딩(Coding)/자료구조 2020. 12. 31. 13:40
Doubly Linked List 지난 포스팅에서 언급했던 Singly Linked List을 보완하여 정의된 Doubly Linked List이다. 단일 링크드 리스트와 다르게 한쪽 방향으로만 pointer가 있는 것이 아닌 좌우로 pointer가 존재한다. 좌우로 pointer를 표현했기 때문에 좀던 자유롭게 Node에 접근할 수 있다. 아래는 지난 글인 Single Linked List이다. jsy-coding-blog.tistory.com/9 [자료구조] Single Linked List Single Linked List Linked List는 많은 양의 자료이동이 필요할때 사용하는 자료구조이다. Linked List는 Node라는 단일된 객체들의 연결로 표현한다. 오늘 포스팅에서 소개할 Sing..
-
[자료구조] Single Linked List코딩(Coding)/자료구조 2020. 12. 28. 12:05
Single Linked List Linked List는 많은 양의 자료이동이 필요할때 사용하는 자료구조이다. Linked List는 Node라는 단일된 객체들의 연결로 표현한다. 오늘 포스팅에서 소개할 Single Linked List는 이러한 연결이 한개로 순차적인 표현을 한다. Single Linked List 설계 단일 연결 리스트의 설계를 해보자 Node 설계 Node는 데이터가 담기는 핵심적인 요소이다. 일반적인 배열로 생각하면 [1,2,4]같이 있다면 "1", "2"같은 단일된 요소 해당 인덱스의 요소를 가리키는 것이다. 그렇다면 Node는 데이터를 저장해야하는 Data변수가 있어야 된다. 그리고 연결을 표현해야함으로 다음 Node로 가는 Pointer가 있어야겠다. 그림으로 표현하면 다음 ..