일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- bfs
- Lv. 0
- Java
- 너비 우선 탐색
- DP
- javascript
- Lv. 2
- Dynamic Programming
- Python
- 백준
- join
- Baekjoon
- SQL
- 자바스크립트
- 파이썬
- Lv. 1
- 깊이 우선 탐색
- 프로그래머스
- Lv. 3
- level 3
- dfs
- select
- 소프티어
- group by
- softeer
- LEVEL 2
- programmers
- 오블완
- 티스토리챌린지
- SQL 고득점 KIT
- Today
- Total
목록Heap (5)
몸과 마음이 건전한 SW 개발자
※ 주의 ※이 블로그는 어디까지나 CS관련 지식을 정리하는 것이 목적입니다. 제가 이해한 내용이 잘못 된 것 같다면 댓글로 남겨주세요. 여러분의 관심이 저의 지식 함양에 도움이 됩니다.>> 그래프의 개념과 종류 그래프는 다양한 객체와 객체 간의 관계를 표현하는 데 적합한 자료구조입니다. 일반적인 선형 자료구조나 트리 자료구조로는 표현하기 어려운 복잡한 관계를 모델링할 수 있습니다. 그래프는 다음과 같은 기본 개념과 종류로 나뉩니다:그래프의 기본 개념정점 (Vertex): 그래프에서 객체를 나타내는 요소입니다.간선 (Edge): 정점 간의 연결 관계를 나타내는 요소입니다.그래프 G = (V, E): 여기서 V는 그래프의 정점들의 집합, E는 정점을 연결하는 간선들의 집합입니다.그래프는 다양한 상황을 모델링..
문제 링크https://school.programmers.co.kr/learn/courses/30/lessons/42626 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr정답 코드import heapqdef solution(scoville, K): answer = 0 heap = [] for s in scoville: heapq.heappush(heap, s) while heap and heap[0] 풀이 방법heap에 scoville을 전부 넣는다.heapq.heapify(scoville)로 scoville을 heap..
문제 링크 https://school.programmers.co.kr/learn/courses/30/lessons/155651 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 정답 코드 def solution(book_time): newBookTime = [] for bts, bte in book_time: nbts = bts.split(":") nbte = bte.split(":") newBookTime.append([int(nbts[0])*60+int(nbts[1]), int(nbte[0])*60+int(nbte[1])]) visited = [0 for..
구현 class heapq { constructor() { this.heap = []; }; size() { return this.heap.length; }; swap(left, right) { [this.heap[left], this.heap[right]] = [this.heap[right], this.heap[left]]; }; heappush(value) { this.heap.push(value); this.bubbleUp(); }; bubbleUp() { let son = this.heap.length - 1; let parent = Math.floor((son - 1) / 2); while (parent >= 0 && this.heap[son] < this.heap[parent]) { this...
문제 링크 https://school.programmers.co.kr/learn/courses/30/lessons/42628 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 정답 코드 import heapq def solution(operations): maxHeap = [] minHeap = [] for operation in operations: oper, number = operation.split() number = int(number) if oper == "I": heapq.heappush(maxHeap, -number) heapq.heappush..