일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
Tags
- concurrency
- 315. Count of Smaller Numbers After Self
- 30. Substring with Concatenation of All Words
- shiba
- kaggle
- attribute
- Protocol
- Python
- 109. Convert Sorted List to Binary Search Tree
- 파이썬
- Class
- DWG
- Substring with Concatenation of All Words
- LeetCode
- Python Code
- 밴픽
- 운영체제
- 715. Range Module
- Generator
- 프로그래머스
- 시바견
- Convert Sorted List to Binary Search Tree
- Regular Expression
- data science
- Python Implementation
- 43. Multiply Strings
- 컴퓨터의 구조
- iterator
- t1
- Decorator
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