본문 바로가기

ror_coding

검색하기
ror_coding
프로필사진 ro_rdil_31

  • Home (158)
    • Data Analysis (13)
      • Growth Hacking (7)
      • Tableau (6)
    • Coding Test (138)
      • Python (86)
      • SQL (52)
    • Certificate (5)
      • 빅데이터 분석 기사 (0)
      • SQLD (3)
      • ADsP (2)
Guestbook
Notice
Recent Posts
Recent Comments
Link
  • RoR's Github
«   2025/09   »
일 월 화 수 목 금 토
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
Tags
  • lv4
  • Stack
  • time complexity
  • 조합
  • LeetCode
  • itertools
  • sql
  • Queue
  • Growth hacking
  • 파이썬
  • level4
  • collections
  • 코테
  • coding
  • mysql
  • import re
  • programmers
  • join
  • Level2
  • AARRR
  • 코딩테스트
  • coding test
  • python
  • tableau
  • 프로그래머스
  • 코딩
  • cte
  • 완전탐색
  • lambda
  • counter
more
Archives
Today
Total
관리 메뉴
  • 글쓰기
  • 방명록
  • RSS
  • 관리

목록Priority Queue (1)

ror_coding

[Python] Heap (Priority Queue)

heapq 는 "우선순위 큐(Priority Queue)"를 구현하는 데 유용함. 우선순위 큐 ) 항목의 우선순위에 따라 처리되는 데이터 구조.따라서 가장 작은(또는 가장 큰) 항목을 우선적으로 처리하는데 사용됨.ex) 작업 스케줄링, 다익스트라 알고리즘(Dijkstra's algorithm) 등. import heapqheapq.heapify(l1) # => 자동 정렬된 list(heap)가 됨. # O(n)# 1. 삽입/추출heapq.heappush(lst, 0) # O(log n)= heapq.heappop(lst) # O(log n)# 2. 삽입+추출= heapq.heappushpop(lst, 0) # O(log n) # 삽입 후, 바로 최솟값 추출.= heapq.heapreplace(lst, i..

Coding Test/Python 2024. 12. 8. 15:36
이전 Prev 1 Next 다음

Blog is powered by kakao / Designed by Tistory

티스토리툴바