반응형 코드트리2 [Coding Test][Python][Shortest Path] Prim 알고리즘 Prim 알고리즘에 앞서 Kruskal 알고리즘을 보고 오시면 좋습니다. [Coding Test][Python][Shortest Path] Kruskal 알고리즘 개념 및 예제, Union - Find 자료구조1. Kruskal 알고리즘이란?그래프의 Minimum Spanning Tree(MST, 최소 신장 트리) 를 구하는 대표적인 알고리즘입니다.Minimum Spanning Tree란 그래프의 모든 Vertex가 연결하면서 Edge의 Weight의 합이 최소가 되는 Trself-objectification.tistory.com 1. Prim 알고리즘이란?Prim 알고리즘은 Kruskal 알고리즘과 같이 Graph에서 Minimum Spanning Tree(MST)를 찾는 알고리즘입니다.특징Kruska.. 2025. 3. 18. [Coding Test][Python][CodeTree] Binary Tree 개념 및 구현 1. Binary Tree(이진 트리) 란?Tree의 각 node가 최대 두 개의 자식(0개, 1개, 2개) Node를 가지는 Tree의 형태의 자료구조입니다.위의 그림은 Binary Tree를 나타낸 그림입니다.2. Binary Tree(이진 트리) 구현Binary Tree는 구현이 간단하는 특징이 있습니다.1) 배열을 이용한 Binary Tree 구현Binary Tree는 자식 Node가 두개이기 때문에 하나는 왼쪽, 하나는 오른쪽에 존재합니다.이 때, Root Node를 배열의 Index 1에 넣게 되면 왼쪽 자식 Node를 Index 2, 오른쪽 자식 Node를 Index 3에 넣어 주면 됩니다.이러한 방식으로 Parent Node의 Index를 i라고 하면 왼쪽 자식 Node는 Index $2i.. 2025. 3. 12. 이전 1 다음 반응형