Skip to content

[mintheon] Week 1 #633

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

Merged
merged 8 commits into from
Dec 10, 2024
Merged

[mintheon] Week 1 #633

merged 8 commits into from
Dec 10, 2024

Conversation

mintheon
Copy link
Member

@mintheon mintheon commented Dec 4, 2024

답안 제출 문제

체크 리스트

  • PR을 프로젝트에 추가하고 Week를 현재 주차로 설정해주세요.
  • 바로 앞에 PR을 열어주신 분을 코드 검토자로 지정해주세요.
  • 문제를 모두 푸시면 프로젝트에서 Status를 In Review로 설정해주세요.
  • 코드 검토자 1분 이상으로부터 승인을 받으셨다면 PR을 병합해주세요.

@mintheon mintheon added the java label Dec 4, 2024
@mintheon mintheon requested a review from neverlish December 4, 2024 17:09
@mintheon mintheon self-assigned this Dec 4, 2024
@mintheon mintheon requested a review from a team as a code owner December 4, 2024 17:09
@HC-kang
Copy link
Contributor

HC-kang commented Dec 4, 2024

안녕하세요 @mintheon 님!
제출해주신 파일들의 마지막에 개행문자를 추가 부탁드려요!

@mintheon mintheon changed the title [mintheon] Week 1 [swaaagger] Week 1 Dec 8, 2024

PriorityQueue<Entry<Integer, Integer>> pq = new PriorityQueue<>((a, b) -> b.getValue().compareTo(a.getValue()));
pq.addAll(frequent.entrySet());

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PriortyQueue랑 정렬은 시간 복잡도는 O(nlogn)으로 동일하지만, 상위 k개 요소를 구할 때는 PriorityQueue가 더 효율적이겠네요! 하나 배워갑니다 :)

Copy link
Member

@DaleSeo DaleSeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Comment on lines +15 to +16
PriorityQueue<Entry<Integer, Integer>> pq = new PriorityQueue<>((a, b) -> b.getValue().compareTo(a.getValue()));
pq.addAll(frequent.entrySet());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

가장 큰 수 k개만 필요한데 반드시 모든 숫자를 정렬해야할까를 고민해보시면 보다 효율적인 알고리즘을 얻으실 수도 있을 것 같습니다.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

가장 큰 수 k개만 필요한데 반드시 모든 숫자를 정렬해야할까를 고민해보시면 보다 효율적인 알고리즘을 얻으실 수도 있을 것 같습니다.

올려주신 풀이의 배열 방법은 생각치 못했어요.
다만 자바로 변환해서 푸니 List<List<>> 방식이 되어 코드가 복잡해지는 경향이 있는것 같아요. 그래도 속도는 확실하네요!! 👍🏻

@mintheon mintheon merged commit 9a79056 into DaleStudy:main Dec 10, 2024
1 check passed
@mintheon mintheon changed the title [swaaagger] Week 1 [mintheon] Week 1 Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Completed
Development

Successfully merging this pull request may close these issues.

4 participants