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