일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- DWG
- 715. Range Module
- Decorator
- Python Implementation
- 109. Convert Sorted List to Binary Search Tree
- 30. Substring with Concatenation of All Words
- Substring with Concatenation of All Words
- Python
- kaggle
- iterator
- t1
- attribute
- 315. Count of Smaller Numbers After Self
- Generator
- 43. Multiply Strings
- 운영체제
- LeetCode
- 밴픽
- Python Code
- 시바견
- concurrency
- Regular Expression
- shiba
- Convert Sorted List to Binary Search Tree
- 컴퓨터의 구조
- data science
- Class
- 파이썬
- Protocol
- 프로그래머스
Archives
- Today
- Total
목록time complexity (1)
Scribbling
Priority Queue
Heapq만을 사용한 Priority Queue의 Time Complexity는 아래와 같다. Find max/min - O(1) Insert - O(logN) Remove - O(N) Remove Operation에 Linear Time이 필요하다는 것이 아쉽다. 이를 해결하기 위한 Custom Priority Queue를 만들었다. 이는 두 개의 Priority Queue를 사용하는 방식이다. 하나의 Queue는 원래 목적인 max/min heap로 사용하고, 나머지 하나의 queue를 쓰레기통으로 사용한다. Time Complexity는 아래와 같다. Find max/min - O(1) Insert - O(logN) Remove - O(logN) 다른 연산은 그다지 어렵지 않으니 Remove 연산만..
Computer Science/Algorithms & Data Structures
2021. 12. 22. 20:21