rryu09

  • 홈
  • 태그
  • 방명록

mst 1

최소 스패닝 트리 find_parent RecursionError

def find_parent(x): if p[x] != x: p[x] = find_parent(p[x]) return p[x] find_parent 에서 재귀가 너무 깊어져서 문제가 생겼다sys.setrecursionlimit 으로 늘려줄 수 도 있겠지만 재귀가 아닌 while 을 사용해 부모를 찾아주는 방식으로 변경했다 def find_parent(x): while p[x] != x: p[x] = p[p[x]] x = p[x] return x

Dev/Algorithm 2024.09.04
이전
1
다음
더보기
프로필사진

rryu09

  • 분류 전체보기 (45)
    • ETC (4)
      • 기록 (3)
    • Dev (2)
      • React (4)
      • React Native (0)
      • JS (0)
      • 졸프 (3)
      • Next.js (0)
      • Cloud (1)
      • Algorithm (28)
      • 리팩토링 (2)

Tag

2차원, Algorithm, API, Audio, Autolayout, babel, BFS, colab, compiler, dfs, DICTIONARY, emotion, es6, figma, FP, Google cloud API, GPT, heapq, image, JavaScript, jest, Knight, lcp, leetcode, Lighthouse, mst, my.cnf, MySQL, Network, next.js, node_modules, npm, object detection, Package Manager, PM, PQ, priority, priority queue, Python, react, storybook, SVG, swc, TfLite, theme, themeProvider, translate, Tree, TTS, TypeScript, UI, usetheme, Word Ladder, Yarn, yarn-berry, yolov5, 개발, 개발자, 공통컴포넌트, 그래프, 누적합, 달팽이, 디자인, 렌더링, 리액트, 리팩토링, 면접, 방문배열, 배열, 배포, 백준, 백트래킹, 부모찾기, 성능개선, 스도쿠, 스토리북, 아이콘, 알고리즘, 오블완, 위상정렬, 이분 그래프, 졸프, 직장인, 최단경로, 최대 증가 부분 수열, 최소 스패닝 트리, 최종합격, 취준, 컴파일러, 컴포넌트, 코딩테스트, 크루스칼, 테스팅, 투포인터, 튜토리얼, 티스토리챌린지, 파이썬, 폰트, 폰트 추천, 프론트엔드,

최근글과 인기글

  • 최근글
  • 인기글

최근댓글

공지사항

페이스북 트위터 플러그인

  • Facebook
  • Twitter

Archives

Calendar

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

방문자수Total

  • Today :
  • Yesterday :
WEB GitHub

Copyright © Kakao Corp. All rights reserved.

티스토리툴바