스누피의 개발로그 🐾

  • 홈
  • 태그
  • 방명록
  • Github

알고리즘 2

[Algorithm] MST: Kruskal & Prim

백준 - 최소 스패닝 트리Kruskal AlgorithmGreedy하게 가장 작은 cost를 가진 edge들을 선택하는 방법이다def kruskal(V, E, EDGES): # Greedy: Kruskal selects minimum edges EDGES.sort(key=lambda x: x[2]) parent = [i for i in range(V)] mst_cost = 0 def find_parent_recursive(x): if parent[x] != x: parent[x] = find_parent_recursive(parent[x]) return parent[x] def find_parent(x): while..

알고리즘 2025.05.03

[Algorithm] Dijkstra

Dijkstra with Priority Queue# Dijkstra Algorithm with Adjacent List and Priority Heap# https://www.acmicpc.net/problem/1753from math import inffrom heapq import heappush as push, heappop as pop# 입력V, E = map(int, input().split())K = int(input()) - 1 # 시작 정점 번호EDGES = [tuple(map(int, input().split())) for _ in range(E)]# Adjacent ListADJ_EDGES = [[] for _ in range(V)]for edge in EDGES: ADJ_EDG..

알고리즘 2025.05.03
이전
1
다음
더보기
프로필사진

스누피의 개발로그 🐾

새로운 기술에 도전하며 삽질을 즐기는 개발자의 블로그입니다 🛠️

  • 분류 전체보기 (7)
    • 아키텍처 (0)
    • 알고리즘 (2)
    • 프론트엔드 (1)
    • 백엔드 (1)
    • 네트워크 (2)
    • 운영체제 (0)

Tag

네트워크, XCode, reactnative, Expo, 삽질,

최근글과 인기글

  • 최근글
  • 인기글

최근댓글

공지사항

페이스북 트위터 플러그인

  • Facebook
  • Twitter

Archives

Calendar

«   2025/05   »
일 월 화 수 목 금 토
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

방문자수Total

  • Today :
  • Yesterday :

Copyright © Kakao Corp. All rights reserved.

  • Github

티스토리툴바