Merged
Conversation
obzva
approved these changes
Jan 30, 2025
Contributor
obzva
left a comment
There was a problem hiding this comment.
이번 주도 고생 많으셨습니다!
저번 주차 피드백까지 반영하시느라 수고하셨네요 ..
감사합니다!!
|
|
||
| 정점 V, 간선 E | ||
| Time: O(V + E) | ||
| Space: O(V + E) |
Contributor
There was a problem hiding this comment.
공간 복잡도 설명을 부탁드려도 될까요? 제 생각엔 O(V)같아서요 :) 채디님 생각이 궁금합니다
Contributor
Author
There was a problem hiding this comment.
O(V) 만큼의 call stack 사용
O(E) 만큼의 oldToNew 의 value (neighbors) 저장
이라고 생각해 O(V + E) 라고 생각했습니다..!
| @@ -0,0 +1,32 @@ | |||
| """ | |||
| 한번에 풀지 못해 다시 풀어볼 예정입니다. | |||
| Solution: 재귀를 활용한 풀이, memo 를 활용한 시간복잡도 개선 | ||
|
|
||
| Time: O(m * n) | ||
| Space: O(2 * m * n) |
Contributor
There was a problem hiding this comment.
일반적으로 Big-O 표기를 할 땐 상수곱을 생략합니다
O(2 * m * n) -> O(m * n)
참고: #445
Contributor
There was a problem hiding this comment.
2도 어떻게 곱하게 되신건지 여쭤볼 수 있을까요 :)
| @@ -0,0 +1,25 @@ | |||
| """ | |||
| Solution: 재귀를 활용한 풀이, memo 를 활용한 시간복잡도 개선 | |||
Contributor
There was a problem hiding this comment.
열정이 있으신 것 같아서 팁을 드리자면, tabulation (흔히 bottom-up라고 부르는..)을 이용하면 좀 더 공간 효율적인 풀이가 가능합니다
고민해보시거나, 이번 기수 저번 기수 다른 분들 풀이를 참고해주세요!
| 2) 중복되는 원소를 발견할 경우 해당 원소의 중복이 사라질때까지 left side 의 원소들을 하나씩 제거한다. | ||
|
|
||
| Time: O(n^2) = O(n) (for iteration) * O(n) 최악의 경우 n만큼의 중복제거 | ||
| Time: O(2n) = O(n) (최악의 경우 n만큼의 중복제거) * O(2) (원소당 최대 2번의 연산) |
Contributor
There was a problem hiding this comment.
이것도 마찬가지로 O(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.
답안 제출 문제
체크 리스트
In Review로 설정해주세요.