1. 자료구조 및 알고리즘 4일차 수강하기
- 최소힙, 최대힙
heapq 모듈을 이용하여서 구현
2. 새롭게 알게된 지식
- 크기가 고정된 리스트의 경우 : sorted 와 max heab 의 시간 복잡도는 N logN 으로 동일하다.
- 크기가 가변되는 경우 : 리스트는 길이가 변할때 마다 시간 복잡도 N 이 증가하지만 heap 의 경우에는 logN 으로 빠르다.
python3 및 pypy3 차이
과제1 : Maximum Product of Two Elements in an Array: https://leetcode.com/problems/maximum-product-of-two-elements-in-an-array/
LeetCode - The World's Leading Online Programming Learning Platform
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
- 코드 구현:
과제2 : The K Weakest Rows in a Matrix: https://leetcode.com/problems/the-k-weakest-rows-in-a-matrix/
LeetCode - The World's Leading Online Programming Learning Platform
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
- 코드 구현:
과제3 : 배열의 K번째 큰 요소 https://leetcode.com/problems/kth-largest-element-in-an-array
LeetCode - The World's Leading Online Programming Learning Platform
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
- 코드 구현:
과제4 : [boj] 최소 힙 : https://www.acmicpc.net/problem/1927
1927번: 최소 힙
첫째 줄에 연산의 개수 N(1 ≤ N ≤ 100,000)이 주어진다. 다음 N개의 줄에는 연산에 대한 정보를 나타내는 정수 x가 주어진다. 만약 x가 자연수라면 배열에 x라는 값을 넣는(추가하는) 연산이고, x가 0
www.acmicpc.net
- 코드 구현:
과제5 : [boj] 최대 힙 : https://www.acmicpc.net/problem/11279
11279번: 최대 힙
첫째 줄에 연산의 개수 N(1 ≤ N ≤ 100,000)이 주어진다. 다음 N개의 줄에는 연산에 대한 정보를 나타내는 정수 x가 주어진다. 만약 x가 자연수라면 배열에 x라는 값을 넣는(추가하는) 연산이고, x가 0
www.acmicpc.net
- 코드구현:
'개발일지' 카테고리의 다른 글
심화 과정 5 일차 (0) | 2024.02.13 |
---|---|
2주차 WIL (0) | 2024.02.09 |
심화 과정 3 일차 (0) | 2024.02.07 |
심화 과정 2 일차 (0) | 2024.02.06 |
심화 과정 1 일차 (1) | 2024.02.05 |