자료 구조 (Data Structure)
컴퓨터 메모리에서 데이터를 효율적으로 사용할 수 있도록 구성, 처리, 검색 및 저장하는 특수 형식.
Web3에서 머클 트리(Merkle [Tree](/ko/terms/merkle-tree))와 같은 자료 구조는 필수적입니다. 블록체인 전체를 다운로드하지 않고도 O(log N) 시간 안에 트랜잭션 포함 여부를 암호학적으로 증명할 수 있게 해줍니다.
graph LR
Center["자료 구조 (Data Structure)"]:::main
Rel_tree["tree"]:::related -.-> Center
click Rel_tree "/terms/tree"
Rel_data_type["data-type"]:::related -.-> Center
click Rel_data_type "/terms/data-type"
Rel_merkle_patricia_trie["merkle-patricia-trie"]:::related -.-> Center
click Rel_merkle_patricia_trie "/terms/merkle-patricia-trie"
classDef main fill:#7c3aed,stroke:#8b5cf6,stroke-width:2px,color:white,font-weight:bold,rx:5,ry:5;
classDef pre fill:#0f172a,stroke:#3b82f6,color:#94a3b8,rx:5,ry:5;
classDef child fill:#0f172a,stroke:#10b981,color:#94a3b8,rx:5,ry:5;
classDef related fill:#0f172a,stroke:#8b5cf6,stroke-dasharray: 5 5,color:#94a3b8,rx:5,ry:5;
linkStyle default stroke:#4b5563,stroke-width:2px;
🧠 지식 테스트
🧒 5살도 이해할 수 있게 설명
100개의 공구를 커다란 자루에 던져 넣으면 드라이버를 찾는 데 오래 걸립니다. 하지만 서랍이 있는 공구함에 잘 정리해두면 즉시 찾을 수 있죠. 자료 구조는 컴퓨터가 데이터를 가장 빨리 찾고 사용할 수 있게 해주는 메모리 속의 '공구함'입니다.
🤓 Expert Deep Dive
추상 자료형(ADT) vs 자료 구조: ADT는 '무엇'을 할지 정의하는 수학적 모델(예: 스택은 LIFO)이고, 자료 구조는 RAM에 '어떻게' 구현할지를 결정합니다(예: 배열 또는 연결 리스트 사용). 배열은 연속된 메모리를 사용하여 접근 시간이 O(1)이지만, 연결 리스트는 포인터를 사용하여 캐시 지역성(Cache locality)이 떨어져 무작위 접근이 O(N)이 됩니다.
❓ 자주 묻는 질문
Why are there so many different data structures?
Because different tasks require different optimizations. If you need to search data quickly, you might use a Hash Table. If you need to keep data in a sorted hierarchy, you use a Tree. There is no single 'best' structure for everything.
What is the difference between an Array and a Linked List?
An array stores items next to each other in memory, making it very fast to jump to a specific item. A linked list stores items wherever there is free space, and each item points to the next one, making it fast to add or remove items without shifting everything else.
What is a Merkle Tree in crypto?
A Merkle Tree is a cryptographic data structure used in blockchains. It allows computers to quickly verify that a specific transaction exists in a block without having to download all the data in the block.