-
Notifications
You must be signed in to change notification settings - Fork 3
[정민서-8주차 알고리즘 스터디] #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
minseojeong1012
wants to merge
50
commits into
SSAFY13th-algorithm:minseojeong/week8
Choose a base branch
from
minseojeong1012:main
base: minseojeong/week8
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[정민서-8주차 알고리즘 스터디] #8
minseojeong1012
wants to merge
50
commits into
SSAFY13th-algorithm:minseojeong/week8
from
minseojeong1012:main
Conversation
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.
🚀 싸피 15반 알고리즘 스터디 8주차 [정민서]
📌 문제 풀이 개요
✅ 문제 해결 여부
💡 풀이 방법
문제 1: N과 M (9)
문제 난이도
실버 2
문제 유형
조합
접근 방식 및 풀이
조합의 순서가 의미가 있었기 때문에 순열 알고리즘을 사용했습니다
집합에 같은 숫자에 대한 처리가 필요해서 그 부분을 따로 추가했습니다
문제 2: 트리의 부모 찾기
문제 유형
순열
문제 난이도
실버 2
접근 방식 및 풀이
어레이리스트를 사용해 값을 받아 저장하는게 처음이라 조금 어려웠습니다. 주어지는 간선이 서로 연결되어 있기 때문에 어레이 리스트를 사용하여 값들을 관리했습니다.
parent 배열을 따로 선언해서 결과 값을 받았고, dfs를 통해 트리의 부모를 탐색했습니다.
문제 3: 구간 합 구하기 5
문제 유형
누적
문제 난이도
실버 1
접근 방식 및 풀이
2차원 배열을 선언하고 값을 받을 때, sum 배열도 선언하여 누적값을 차례대로 저장했습니다.
누적값을 저장하는 배열에는 규칙이 있는데, 구하고자 하는 값의 왼쪽 값 + 위쪽 값 - 중복된 값 + 현재 위치 값 (누적값 아님) 을 하면 i , j 위치의 누적값을 구할 수 있습니다.
그 후 (x1, y1) (x2, y2) 값을 받고
sum[x2][y2] - sum[x1-1][y2] - sum[x2][y1-1] + sum[x1-1][y1-1];
을 해줘 해당 구간의 누적값을 구할 수 있었습니다.
문제 4: 이진 검색 트리
문제 유형
그래
문제 난이도
골드 4
접근 방식 및 풀이
처음 문제를 보고 3개의 값을 어떻게 저장할까 하다가, 따로 노드 클래스를 만들어 왼쪽값, 오른쪽값, value를 관리 해주었습니다
그 후 insert 메서드를 통해 값이 크기를 구분해가며 노드의 오른쪽, 왼쪽에 삽입했고
마지막으로 후위 순회를 위한 메서드를 구성해서 순서에 맞게 프린트 했습니다.
문제 5:
문제 유형
문제 난이도
접근 방식 및 풀이