본문 바로가기
leetcode

Data Structure

by sk_victoria 2024. 2. 18.

출처 : https://www.youtube.com/watch?v=ansd5B27uJM&list=PLi-xJrVzQaxXC2Aausv_6mlOZZ2g2J6YB&index=2


알고리즘 문제가 나왔을때 자동적으로 생각해야하는것 3가지가 있다.

  1. 아이디어
  2. 시간복잡도
  3. 자료구조

어떤 자료구조를 써야할지에 대해 바로바로 떠올릴수 있도록 하려 한다.

Stack

Queue

  • priority
  • circular

linked list

  • singly
  • doubly
  • circular

Hash table

heap

  • 최대값/최소값을 빠르게 계산하기 위한 자료구조
  • 이진 트리 구조
  • 처음에 저장할때부터 최대값 or 최소값을 결정하도록

tree

  • binary
  • skip list
  • trie
  • b+ tree

Set : based on Hash table, O(1) when searching

  • disjoint

graph

  • directed
  • indirected

List : O(n) when searching

Array

댓글