❓
물음표살인마 블로그
  • README
  • ALGORITHM
    • Sieve of Eratosthenes
    • Round Up
    • Binary Search
    • Union Find
    • Sorting Array
    • Lcm, Gcd
  • TechTalk Review
    • Template
  • Books
    • CS Note for Interview
      • Ch1. Design Pattern & Programming paradigm
        • 1.1.1 Singleton Pattern
        • 1.1.2 Factory Pattern
        • 1.1.4 Observer Pattern
        • 1.1.5 Proxty Pattern & Proxy Server
        • 1.1.8 Model-View-Controller Pattern
        • 1.2.1 Declarative and Functional Programming
        • 1.2.2 Object Oriented Programming
      • Ch2. Network
        • 2.2.1 TCP/IP Four-Layer Model
        • 2.2.1-1 TCP 3, 4 way handshake
        • 2.3 Network Devices L4, L7
        • 2.4.1 ARP, RARP
        • 2.4.2 Hop By Hop Communication
        • 2.4.3 IP Addressing Scheme
      • Ch3. Operating System
        • 3.1.1 Roles and Structure of Operating Systems
        • 3.2.1 Memory Hierarchy
        • 3.2.2 Memory Management
        • 3.3.1 Processes and Compilation Process
        • 3.3.3 Memory Structure of a Process
        • 3.3.4 Process Control Block (PCB)
        • 3.3.5 Multiprocessing
        • 3.3.6 Threads and Multithreading
        • 3.3.7 Shared Resources and Critical Sections
        • 3.3.8 Deadlock
        • 3.4 CPU Scheduling Algorithm
      • Ch4. Database
        • 4.1 Database Basic
        • 4.2 Normalization
        • 4.3 Transaction and Integrity
        • 4.4 Types of Databases
        • 4.5 Indexes
        • 4.6 Types of Joins
        • 4.7 Principles of Joins
      • Ch5. Data Structure
    • Learning the Basics of Large-Scale System Design through Virtual Interview Cases
      • 1. Scalability based on user counts(1/2)
      • 1. Scalability based on user counts(2/2)
      • 2.Back-of-the-envelope estimation
      • 3. Strategies for System Design Interviews
      • 4. Rate Limiter
      • 5. Consistent Hashing
      • 6. Key-Value System Design
      • 7. Designing a Unique ID Generator for Distributed Systems
      • 8. Designing a URL Shortener
      • 9. Designing a Web Crawler
      • 10. Notification System Design
      • 11. Designing a News Feed System
      • 12. Chat System Design
      • 13. AutoComplete
      • 14. Design YouTube
      • 15. Design Google Drive
      • Loadbalancer Algorithms
      • Cache tier
      • CDN, Content Delivery Network
      • Stateless Web tier
    • Computer System A programmer's perspective
    • Effective Java
      • Item 1. Consider Static Factory Methods Instead of Constructors
      • Item 2. Consider a Builder When Faced with Many Constructor Parameters
      • Item 3. Ensure Singleton with Private Constructor or Enum Type
      • Item 4. Enforce Noninstantiability with a Private Constructor
      • Item 5. Prefer Dependency Injection to Hardwiring Resources
      • Item 6. Avoid Creating Unnecessary Objects
      • Item 7. Eliminate Obsolete Object References
      • Item 8. Avoid Finalizers and Cleaners
      • Item 9.Prefer try-with-resources to try-finally
      • Item10. Adhering to General Rules When Overriding equals
        • Handling Transitivity Issues
        • Ensuring Consistency
      • Item11. Override hashCode When You Override equals
      • Item12. Always Override toString
        • Always Override toString
      • Item13. Override Clone Judiciously
      • Item14. Consider Implementing Comparable
      • Item15. Minimize the Accessibility of Classes and Members
      • Item16. Accessor Methods Over Public Fields
      • Item17. Minimize Mutability
      • Item18. Composition over inherentance
      • Item19. Design and Document for Inheritance, or Else Prohibit It
      • Item20. Prefer Interfaces to Abstract Classes
      • Item21. Design Interfaces with Implementations in Mind
      • Item22. Use Interfaces Only to define Types
      • Item23. Prefer Class Hierarchies to Tagged Classes
      • Item24. Favor Static Member Classes Over Non-Static
      • Item28. Use Lists Instead of Arrays
      • Item29. Prefer Generic Types
      • Item30. Favor Generic Methods
    • Head First Design Patterns
      • Ch1. Strategy Pattern
      • Ch2. Observer Pattern
        • Ver1. Ch2. Observer Pattern
      • Ch3. Decorator Pattern
        • Ch3. Decorator Pattern
      • Ch4. Factory Pattern
      • Ch5. Singleton Pattern
      • Ch6. Command Pattern
      • Ch7. Adapter and Facade Pattern
      • Ch8. Template Method Pattern
    • Digging Deep into JVM
      • Chapter 2. Java Memory Area & Memory Overflow
      • Chapter 3. Garbage Collector & Memory Allocation Strategy (1/2)
      • Chapter 3. Garbage Collector & Memory Allocation Strategy (2/2)
      • Chapter 5. Optimization Practice
      • Chapter 6. Class file structure
      • Chapter 8. Bytecode Executor Engine (1/2)
  • Interview Practices
    • Restful API Practices
      • Url Shortener API
      • Event Ticket Reservation API
      • Course Management API
      • Search posts by tags API
      • Online Code platform API
      • Simple Task Management API
      • Event Participation API
      • Review System API
      • Car management API
      • Online Library
    • Tech Review
      • if(kakao)
        • Kakao Account Cache Migration / if(kakao)2022
        • Improving the Anomaly Detection System for KakaoTalk Messaging Metrics / if(kakao) 2022
        • Standardizing API Case Handling Without Redeployment / if(kakaoAI)2024
        • JVM warm up / if(kakao)2022
    • Naver Computer Science
      • Process & Thread
      • TCP & UDP
      • Spring & Servlet
      • Filter & Interceptor & AOP
      • Equals() & ==
      • Dependency Injection
      • Object Oriented Programming
  • F-Lab
    • Week1
      • Client & Server
      • HTTP
      • TCP/UDP
      • REST API
      • Questions
        • Object Oriented Programming
        • HTTP
        • Process & Thread
        • Data Structure
    • Week2
      • OSI 7 layer
      • Web vs WAS
    • Week3
      • RDB vs NoSQL
      • RDB Index
      • Cache
      • Redis
      • Messaging Queue
    • Week4
      • Project - Ecommerce
    • Week5
      • ERD - 1
    • Week6
      • Ecommerce - 2
      • Role
      • pw hashing && Salt
      • CreatedAt, ModifiedAt
      • JWT
      • Copy of ERD - 1
    • Week7
      • Vault (HashiCorp Vault)
    • Week 8
      • Api Endpoints
    • Week10
      • Product Create Workflow
  • TOY Project
    • CodeMentor
      • Implementation of Kafka
      • Project Improvement (Architectural Enhancements)
      • Communication between servers in msa
  • JAVA
    • MESI protocol in CAS
    • CAS (Compare and Set)
    • BlockingQueue
    • Producer & Consumer
    • Synchronized && ReentrantLock
    • Memory Visibility
    • Checked vs Unchecked Exception
    • Thread
    • Batch delete instead of Cascade
    • Java Questions
      • Week 1(1/2) - Basic Java
      • Week 1(2/2) - OOP
      • Week 2(1/2) - String, Exception, Generic
      • Week2(2/2) Lambda, Stream, Annotation, Reflection
      • Week3(1/2) Collections
      • Week3(2/2) Threads
      • Week4 Java Concurrency Programming
      • Week5 JVM & GC
    • Java 101
      • JVM Structure
      • Java Compiles and Execution Method
      • Override, Overload
      • Interface vs Abstract Class
      • Primitive vs Object Type
      • Identity and equality
      • String, StringBuilder, StringBuffer
      • Checked Exceptions and Unchecked Exceptions
      • Java 8 methods
      • Try-with-reources
      • Strong Coupling and Loose Coupling
      • Serialization and Deserialization
      • Concurrency Programming in Java
      • Mutable vs Immutable
      • JDK vs JRE
  • SPRING
    • DIP. Dependency Inversion Principal
    • Ioc container, di practice
    • @Transactional
    • Proxy Pattern
    • Strategy Pattern
    • Template Method Pattern
    • using profile name as variable
    • Spring Questions
      • Spring Framework
      • Spring MVC & Web Request
      • AOP (Aspect-Oriented Programming)
      • Spring Boot
      • ORM & Data Access
      • Security
      • ETC
  • DATABASE
    • Enhancing Query Performance & Stability - User list
    • Ensuring Data Consistency, Atomicity and UX Optimization (feat.Firebase)
    • Redis: Remote Dictionary Server
    • Database Questions
      • Week1 DBMS, RDBMS basics
      • Week2 SQL
      • Week3 Index
      • Week4 Anomaly, Functional Dependency, Normalization
      • Week5 DB Transaction, Recovery
    • Normalization
      • 1st Normal Form
      • 2nd Normal Form
      • 3rd Normal Form
  • NETWORK
    • HTTP & TCP head of line blocking
    • HTTP 0.9-3.0
    • Blocking, NonBlocking and Sync, Async
    • Network Questions
      • Week1 Computer Network Basic
      • Week2(1/3) Application Layer Protocol - HTTP
      • Week2(2/3) Application Layer Protocol - HTTPS
      • Week2(3/3) Application Layer Protocol - DNS
      • Week3 Application Layer
      • Week4 Transport Layer - UDP, TCP
      • Week5 Network Layer - IP Protocol
    • Network 101
      • https://www.google.com
      • TCP vs UDP
      • Http vs Https
      • TLS Handshake 1.2
      • HTTP Method
      • CORS & SOP
      • Web Server Software
  • OS
    • Operating System Questions
      • Week1 OS & How Computer Systems Work
      • Week2(1/2) Process
      • Week2(2/2) Thread
      • Week3 CPU Scheduling
      • Week4 Process Synchronize
      • Week5 Virtual Memory
    • Operating System 101
      • Operating system
        • The role of the operating system
        • The composition of the operating system.
      • Process
        • In Linux, are all processes except the initial process child processes?
        • Zombie process, orphan process
        • (Linux) Daemon process
        • Process address space
        • Where are uninitialized variables stored?
        • Determination of the size of the Stack and Heap
        • Access speed of Stack vs Heap
        • Reason for memory space partitioning
        • Process of compiling a process
        • sudo kill -9 $CURRENT_PID
      • Thread
        • Composition of a thread's address space
      • Process vs Thread
        • Creation of processes and threads in Linux
      • Multiprocessing
        • Web Browser
        • Implementation of multiprocessing
        • Application areas of multiprocessing
      • Multithreading
        • Application areas of multithreading
      • Interrupt
        • HW / SW Interrupt
        • Method of handling interrupts
        • Occurrence of two or more interrupts simultaneously
      • Polling
      • Dual Mode
        • Reason for distinguishing between user mode and kernel mode
      • System call
        • Differentiation between system calls
        • Types of system calls
        • Execution process of a system call
      • Process Control Block (PCB)
        • PCB의 구조
        • 쓰레드는 PCB를 갖고 있을까?
        • 프로세스 메모리 구조
      • Context switching
        • Timing of context switching
        • Registers saved during context switching
        • Context switching in processes
        • Context switching in threads
        • Difference between context switching in processes and threads
        • Information of the current process during context switching
      • Interprocess Communication (IPC)
        • Cases where IPC is used
        • Process address space in IPC Shared Memory technique
        • Types of IPC
  • COMPUTER SCIENCE
    • Computer Architecture 101
      • 3 components of a computer
      • RAM vs ROM
      • CPU vs GPU
      • SIMD
      • Two's complement
      • Harvard Architecture vs. von Neumann Architecture
      • The structure of a CPU.
      • Instruction cycle (CPU operation method)
      • Instruction pipelining
      • Bus
      • Memory area
      • Memory hierarchy structure
        • Reason for using memory hierarchy structure
      • Cache memory
      • L1, L2, L3 Cache
      • Locality of reference (cache)
      • Fixed-point vs Floating-point
        • epresentation of infinity and NaN (Not a Number) in floating-point
      • RISC vs CISC
      • Hamming code
      • Compiler
      • Linking
      • Compiler vs Interpreter
      • Mutex vs Semaphore
      • 32bit CPU and 64bit CPU
      • Local vs Static Variable
      • Page
  • Programming Paradigm
    • Declarative vs Imperative
  • JPA, QueryDsl
    • why fetchResults() is deprecated
  • PYTHON
    • Icecream
  • FASTAPI
    • Template Page
  • LINUX
    • Template Page
  • DATA STRUCTURE
    • Counting Sort
    • Array vs Linked List
  • GIT, Github
    • git clone, invalid path error
  • INFRA
    • Template Page
  • AWS
    • Server Log Archive Pipeline
    • Image Processing using Lambda
  • DOCKER
    • Docker and VM
    • Python Executable Environment
    • Docker commands
  • docker-compose
    • Kafka, Multi Broker
  • KUBERNATES
    • !Encountered Errors
      • my-sql restarts
      • kafka producer: disconnected
    • Kubernetes Components
    • Helm
      • Helm commands
    • Pod network
    • Service network
      • deployment.yaml
      • services.yaml
    • Service type
      • Cluster IP
      • NodePort
    • service-name-headless?
    • kube-proxy
  • GraphQL
    • Template Page
  • WEB
    • Template Page
  • Reviews
    • Graphic Intern Review
    • Kakao Brain Pathfinder Review
    • JSCODE 자바 1기 Review
  • 😁Dev Jokes
    • Image
      • Plot twist
      • Priorities
      • SQL join guide
      • Google is generous
      • Genie dislikes cloud
      • buggy bugs
      • last day of unpaid internship
      • what if clients know how to inspect
      • its just game
      • how i wrote my achievement on resume
      • self explanatory
      • chr(sum(range(ord(min(str(not))))))
Powered by GitBook
On this page
  • 5.1 자료구조의 기본 개념
  • 5.1.1 시간 복잡도 (Time Complexity)
  • 5.1.2 공간 복잡도 (Space Complexity)
  • 5.1.3 자료구조에서의 시간 복잡도
  • 5.2 선형 자료구조
  • 5.2.1 배열 (Array)
  • 5.2.2 연결 리스트 (Linked List)
  • 5.2.3 백터 (Vector)
  • 5.2.4 스택 (Stack)
  • 5.2.5 큐 (Queue)
  • 5.3 비선형 자료구조
  • 5.3.1 그래프 (Graph)
  • 5.3.2 트리 (Tree)
  • 5.3.3 이진 트리 (Binary Tree)
  • 5.3.4 AVL 트리 (AVL Tree)
  • 5.3.5 레드블랙 트리 (Red-Black Tree)
  • 5.3.6 힙 (Heap)
  • 5.3.7 우선순위 큐 (Priority Queue)
  • 5.3.8 맵 (Map)
  • 5.3.9 셋 (Set)
  • 5.3.10 해시 테이블 (Hash Table)
  1. Books
  2. CS Note for Interview

Ch5. Data Structure

5장 자료구조

5.1 자료구조의 기본 개념

자료구조를 이해하는 데 있어서 가장 중요한 개념은 시간 복잡도와 공간 복잡도입니다. 이 두 가지 개념은 자료구조와 알고리즘을 평가하는 데 중요한 기준이 됩니다.

5.1.1 시간 복잡도 (Time Complexity)

시간 복잡도는 알고리즘이 실행되는 데 걸리는 시간을 나타내며, 주어진 입력 크기 n에 따라 함수로 표현됩니다. 시간 복잡도는 빅오 표기법(Big-O Notation)을 사용해 최악의 경우에 대한 성능을 평가합니다.

5.1.2 공간 복잡도 (Space Complexity)

공간 복잡도는 알고리즘이 실행되는 동안 필요한 메모리의 양을 의미합니다. 시간 복잡도와 마찬가지로 입력 크기 n에 따라 함수로 표현됩니다. 공간 복잡도 역시 빅오 표기법으로 표현되며, 알고리즘이 얼마나 메모리를 효율적으로 사용하는지 평가할 수 있습니다.

5.1.3 자료구조에서의 시간 복잡도

각 자료구조는 특정 연산에서 서로 다른 시간 복잡도를 가집니다. 예를 들어, 배열은 인덱스를 통한 접근은 O(1)의 시간 복잡도를 가지지만, 삽입이나 삭제는 O(n)의 시간이 걸립니다. 반면, 연결 리스트는 삽입과 삭제가 O(1)의 시간 복잡도를 가지지만, 인덱스를 통한 접근은 O(n)의 시간이 소요됩니다.

다음은 주요 자료구조에서의 시간 복잡도를 정리한 표입니다:

자료구조
접근
탐색
삽입
삭제

배열

O(1)

O(n)

O(n)

O(n)

연결 리스트

O(n)

O(n)

O(1)

O(1)

스택

O(n)

O(n)

O(1)

O(1)

큐

O(n)

O(n)

O(1)

O(1)

해시 테이블

O(1)

O(1)

O(1)

O(1)

이러한 시간 복잡도는 자료구조를 선택할 때 중요한 기준이 되며, 효율적인 코드 작성에 필수적인 요소입니다.

5.2 선형 자료구조

선형 자료구조는 데이터가 순차적으로 저장되는 구조를 의미합니다. 이 장에서는 배열, 연결 리스트, 백터, 스택, 큐에 대해 설명합니다.

5.2.1 배열 (Array)

배열은 선형 자료구조의 대표적인 예로, 동일한 데이터 타입의 요소들이 연속적인 메모리 공간에 저장됩니다. 배열의 특징과 사용법은 다음과 같습니다:

  • 고정된 크기: 배열은 생성 시 크기가 고정되며, 이후에는 크기를 변경할 수 없습니다.

  • 빠른 접근: 인덱스를 통해 O(1) 시간 복잡도로 요소에 접근할 수 있습니다.

  • 비효율적인 삽입/삭제: 배열의 중간에 요소를 삽입하거나 삭제할 경우, 해당 위치 이후의 모든 요소를 이동해야 하므로 O(n)의 시간 복잡도가 발생합니다.

배열은 데이터의 크기가 고정되어 있고, 인덱스를 통한 빠른 접근이 필요한 상황에 적합합니다.

5.2.2 연결 리스트 (Linked List)

연결 리스트는 배열과 달리 각 요소가 데이터와 다음 요소를 가리키는 포인터를 함께 저장하는 구조입니다. 연결 리스트는 크기가 가변적이며, 삽입 및 삭제가 용이합니다. 종류에는 단일 연결 리스트, 이중 연결 리스트, 원형 연결 리스트가 있습니다.

연결 리스트는 삽입과 삭제가 빈번하게 발생하는 상황에서 유리합니다. 그러나 특정 인덱스의 요소에 접근하기 위해 처음부터 탐색해야 하므로, 접근 속도는 배열보다 느립니다.

5.2.3 백터 (Vector)

백터는 동적 배열로, 크기가 자동으로 조정되는 배열입니다. 자바에서의 ArrayList가 백터의 대표적인 예입니다. 백터는 다음과 같은 특징을 가지고 있습니다:

  • 동적 크기: 요소가 추가될 때 자동으로 크기가 조정됩니다.

  • 빠른 접근: 배열과 마찬가지로 인덱스를 통한 O(1) 시간 복잡도로 요소에 접근할 수 있습니다.

  • 메모리 오버헤드: 크기가 동적으로 조정되기 때문에 메모리 사용량이 비효율적일 수 있습니다.

백터는 크기가 자주 변하는 데이터를 관리할 때 유용하며, 배열보다 유연한 대안입니다.

5.2.4 스택 (Stack)

스택은 후입선출(LIFO) 구조를 가지며, 마지막에 삽입된 요소가 가장 먼저 제거됩니다. 주요 연산으로는 push(요소 추가), pop(요소 제거), peek(요소 조회) 등이 있습니다.

스택은 재귀적인 알고리즘, 괄호 짝 맞추기, 웹 브라우저의 뒤로 가기 기능 등에서 자주 사용됩니다.

5.2.5 큐 (Queue)

큐는 선입선출(FIFO) 구조를 가지며, 먼저 삽입된 요소가 먼저 제거됩니다. 주요 연산으로는 enqueue(요소 추가), dequeue(요소 제거), peek(요소 조회) 등이 있습니다.

큐는 데이터가 순차적으로 처리되어야 하는 상황에서 사용되며, BFS(너비 우선 탐색)와 같은 알고리즘에서 활용됩니다.


5.3 비선형 자료구조

비선형 자료구조는 데이터가 계층적이거나 네트워크 구조로 저장되는 자료구조입니다. 이 장에서는 그래프, 트리, 이진 트리, AVL 트리, 레드블랙 트리, 힙, 우선순위 큐, 맵, 셋, 해시테이블에 대해 설명합니다.

5.3.1 그래프 (Graph)

그래프는 정점(Vertex)과 간선(Edge)으로 이루어진 자료구조로, 정점 간의 관계를 표현합니다. 그래프는 방향 그래프와 무방향 그래프로 나뉘며, 가중치가 있을 경우 가중 그래프라고 부릅니다.

그래프는 네트워크 모델링, 최단 경로 탐색, 사회적 관계 분석 등에서 자주 사용됩니다.

5.3.2 트리 (Tree)

트리는 계층적 구조를 표현하기 위한 비선형 자료구조입니다. 트리는 루트 노드를 중심으로 여러 자식 노드를 가지며, 이 자식 노드들 또한 자신의 자식을 가질 수 있습니다. 트리는 이진 트리, 이진 탐색 트리, AVL 트리 등 다양한 종류가 있습니다.

5.3.3 이진 트리 (Binary Tree)

이진 트리는 각 노드가 최대 두 개의 자식 노드를 가지는 트리입니다. 이진 트리의 특징은 다음과 같습니다:

  • 완전 이진 트리: 모든 레벨이 꽉 찬 이진 트리입니다.

  • 포화 이진 트리: 모든 노드가 두 개의 자식 노드를 가지며, 마지막 레벨을 제외한 모든 레벨이 꽉 차 있습니다.

  • 이진 탐색 트리: 왼쪽 자식 노드는 부모 노드보다 작고, 오른쪽 자식 노드는 부모 노드보다 큽니다.

이진 트리는 데이터 탐색, 정렬, 효율적인 데이터 저장을 위해 자주 사용됩니다.

5.3.4 AVL 트리 (AVL Tree)

AVL 트리는 자가 균형 이진 탐색 트리로, 모든 노드의 왼쪽 서브트리와 오른쪽 서브트리의 높이 차이가 1 이하로 유지되도록 자동으로 균형을 맞춥니다. 삽입이나 삭제 시 트리의 균형이 깨지면 회전 연산을 통해 균형을 복원합니다.

AVL 트리는 삽입, 삭제, 탐색 연산에서 O(log n)의 시간 복잡도를 유지하기 때문에, 효율적인 검색과 정렬이 요구되는 상황에서 유리합니다.

5.3.5 레드블랙 트리 (Red-Black Tree)

레드블랙 트리는 또 다른 자가 균형 이진 탐색 트리로, 노드에 색깔(레드 또는 블랙)을 부여하여 트리의 균형을 유지합니다. 레드블랙 트리는 AVL 트리보다 조금 덜 엄격하게 균형을 유지하기 때문에, 삽입과 삭제가 더 빠르게 이루어질 수 있습니다.

레드블랙 트리는 주로 데이터베이스나 파일 시스템에서 사용됩니다.

5.3.6 힙 (Heap)

힙은 완전 이진 트리의 일종으로, 부모 노드가 자식 노드보다 크거나 작은 특성을 가집니다. 이 특성에 따라 최대 힙(Max Heap)과 최소 힙(Min Heap)으로 나뉩니다. 힙은 주로 우선순위 큐의 기본 자료구조로 사용됩니다.

힙은 정렬된 데이터를 관리하거나, 가장 큰/작은 요소를 빠르게 찾는 경우에 유용합니다.

5.3.7 우선순위 큐 (Priority Queue)

우선순위 큐는 각 요소가 우선순위를 가지며, 높은 우선순위를 가진 요소가 먼저 처리되는 자료구조입니다. 우선순위 큐는 힙을 사용하여 구현되는 경우가 많습니다.

우선순위 큐는 작업 스케줄링, 시뮬레이션 시스템 등에서 자주 사용됩니다.

5.3.8 맵 (Map)

맵은 키-값 쌍으로 데이터를 저장하는 자료구조로, 해시 테이블을 이용해 구현됩니다. 각 키는 유일하며, 키를 통해 값에 빠르게 접근할 수 있습니다. 자바에서는 HashMap, TreeMap 등이 맵의 대표적인 구현체입니다.

맵은 데이터베이스 인덱싱, 캐싱, 집합 연산 등에서 사용됩니다.

5.3.9 셋 (Set)

셋은 유일한 요소들로 이루어진 집합을 표현하는 자료구조로, 중복된 값을 허용하지 않습니다. 해시 테이블을 기반으로 한 HashSet, 정렬된 순서를 유지하는 TreeSet 등이 자바에서의 셋 구현체입니다.

셋은 집합 연산, 중복 제거 등에서 유용하게 사용됩니다.

5.3.10 해시 테이블 (Hash Table)

해시 테이블은 키를 해시 함수로 변환하여 값을 저장하는 자료구조로, 매우 빠른 검색 속도를 제공합니다. 해시 테이블의 주요 특징은 다음과 같습니다:

  • O(1)의 시간 복잡도: 평균적으로 O(1) 시간 내에 데이터에 접근할 수 있습니다.

  • 해시 충돌 처리: 동일한 해시 값을 가진 키가 존재할 수 있으므로, 이를 처리하기 위한 방법이 필요합니다.

해시 테이블은 데이터베이스, 캐시, 검색 알고리즘 등에서 널리 사용됩니다.

Previous4.7 Principles of JoinsNextLearning the Basics of Large-Scale System Design through Virtual Interview Cases

Last updated 9 months ago