-
Notifications
You must be signed in to change notification settings - Fork 126
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
[EGON] Week 01 Solutions #322
Conversation
stack = [root] | ||
while stack: | ||
curr_node = stack.pop() | ||
heappush(visited, curr_node.val) |
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.
다양한 풀이로 하셔서 좋네요 :) 요부분 조금 궁금한게 있는데, bst의 heappush의 Time complexity가 제 기억엔 logn 이었던거로 기억하는데, 혹시 어떻게 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.
n개의 노드를 순회하며 각각 heap push를 하니 말씀하신 것 처럼 n * log n 이 맞습니다. 주석 복붙하다 빼먹은 것 같네요. 리뷰 감사합니다.
일단 5문제 다 풀으신거 같아 ready to review 로 전환했습니다 :) |
부끄럽습니다... |
@leokim0922 수정 및 swift 풀이 추가했습니다 |
if len(vals) >= k: | ||
return |
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.
이 조건으로 빠르게 탐색을 마칠 수 있어 정말 좋네요! 👍
Python
Swift