본문 바로가기
반응형

SWE327

[Leetcode][python] 17 Letter Combinations of a Phone number problem : https://leetcode.com/problems/letter-combinations-of-a-phone-number/ Letter Combinations of a Phone Number - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com code: from collections import defaultdict # 1. make phone digits hashmap d = defaultdict() asciiValue = 97 # 'a' fo.. 2022. 3. 28.
DFS BFS d DFS BFS Depth First Search Breadth First Search Stack / Recursive Queue Time Complexity: - 인접 리스트로 표현된 그래프 O(N+E) - 인접 행렬로 표현된 그래프 O(N^2) N is the number of nodes in the graph, E is the number of edges adjacent matrix dfs 시간 복잡도 dfs(x)는 x에 방문하는 함수이므로 정점의 개수, 즉 차수인 V번만큼 dfs(x)가 호출됩니다. 따라서 dfs(x) 시간복잡도 *V가 전체 dfs 알고리즘의 시간복잡도가 됩니다. - 인접 행렬로 표현된 그래프 모든 정점을 다 찾아봐야하기 때문에 dfs(x)의 시간복잡도는 O(N) dfs(x)가 .. 2022. 3. 28.
Hashmap algorithm Hash Function best O(1), worst O(n) Load Factor : n/table size , smaller smaller is better Seperate chaining Open Addressing - Python Dictionary -> rehasing ss ListNode: def __init__(self, key=None, value=None): self.key = key self.value = value self.next = None class MyHashMap: def __init__(self): self.size = 1000 self.table = collections.defaultdict(ListNode) def put(self, key:int, value: int).. 2022. 3. 28.
QToolTip이란? Qt 말풍선 사용법 | QToolTip에 이미지 넣는 방법 QtoolTip 이란? 툴팁이란 마우스가 특정 아이템 위에 올라갔을 때 뜨는 말풍선이다. 아래 이미지를 보면 마우스가 삼각형 위에 올라갔을 때 뜨는 'Triangle' 말풍선을 볼 수 있다. 이런 말풍선을 Qt에서는 QToolTip으로 쉽게 구현할 수 있게 해준다. QToolTip 사용 방법 QToolTip을 사용하는 방법은 크게 2가지가 있다. 먼저 QToolTip을 사용하려면 마우스가 해당 아이템 위에 들어왔다는 마우스 이벤트를 받아야 한다. 여기서, 마우스 이벤트를 받는 방식이 2가지이다. (1) installeventfilter 위젯에 이벤트 필터를 등록하면 모든 이벤트는 이벤트필터로 가장 먼저 들어온다! 여기에서 필요 없는 이벤트는 리턴해줘서, 다른 위젯에서 받아서 처리하게 된다. QObject.. 2022. 3. 17.
반응형