Merged
Conversation
bona1122
approved these changes
Feb 11, 2025
Collaborator
bona1122
left a comment
There was a problem hiding this comment.
정리해 주신 내용이랑 코드들 잘 봤습니다. 이진검색트리 검증 문제 풀어주신 코드 보면서 직계자손뿐 아닌 왼쪽 '서브트리' < 루트 < 오른쪽 '서브트리' 대해 한번 더 리마인드 하고 갑니다. 그리고 (숫자).toString(n) : n진수 문자열로 변환도 배우고 갑니다! 여담으로 매번 느끼지만 재귀로 짜여진 코드는 한번에 이해하기 참 어렵네요 ㅜㅜ... 한 주 동안 수고하셨습니다!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[트리]
🎄트리(Tree)란?
트리의 기본 용어
트리의 종류
⭐가장 유명한 이진 트리의 순회 방법
방법1. DFS (Depth-First Search, 깊이 우선 탐색)
-> 한쪽 방향으로 깊이 들어가면서 탐색하는 방식
방법2. BFS (Breadth-First Search, 너비 우선 탐색)
-> 루트에서 가까운 노드부터 탐색하는 방식
🌟그리고 문제 풀면서 항상 나오는 개념이라고 생각하는...🌟
재귀란?
💡재귀 함수의 필수 요소
-> 트리문제에서 재귀적 방법으로 풀이하는 이유는!
트리의 구조가 각 노드는 또 다른 작은 트리로 구성되기 때문에, 자기 자신을 호출하는 방식(재귀)이 자연스럽게 적용될 수 있음.
해시맵이란?
-> 트리 문제에서 해시맵을 사용하는 이유는!
트리 문제에서는 특정 값을 빠르게 찾거나 저장해야 하는 경우가 많은데, 이때 해시맵을 사용하면 **O(1)**로 해결할 수 있음.
💡해시맵이 유용한 경우
📌 푼 문제
📝 간단한 풀이 과정
104. Maximum Depth of Binary Tree
94. Binary Tree Inorder Traversal
100. Same Tree
226. Invert Binary Tree
102. Binary Tree Level Order Traversal
98. Validate Binary Search Tree
105. Construct Binary Tree from Preorder and Inorder Traversal
트리 순회 방법
이진 변환 반복하기
124. Binary Tree Maximum Path Sum
트리는 항상 봐도 어렵네요,, 다른 문제들보다