René's URL Explorer Experiment


Title: p.g. 596의 '이중 우선순위 큐' 풀이1, 3 (이중 구조 방식) · Issue #4 · onlybooks/java-algorithm-interview · GitHub

Open Graph Title: p.g. 596의 '이중 우선순위 큐' 풀이1, 3 (이중 구조 방식) · Issue #4 · onlybooks/java-algorithm-interview

X Title: p.g. 596의 '이중 우선순위 큐' 풀이1, 3 (이중 구조 방식) · Issue #4 · onlybooks/java-algorithm-interview

Description: 제가 가지고 있는 전자책은 2023년 10월 20일 버전 1.0 입니다. p.g. 596의 '이중 우선순위 큐' 풀이1, 3 (이중 구조 방식)에 질문이 있어 문의 드립니다. 풀이1, 3 모두 언어의 차이(java, kotlin)만 있을 뿐, 모두 이중 구조 방식으로 풀이하고 있습니다. 하지만 값을 추출한 후, 대응하는 다른 힙의 엘리먼트를 삭제하는 과정이 비효율적이라고 생각합니다. => 최대값 추출의 경우, 최대힙에서 ...

Open Graph Description: 제가 가지고 있는 전자책은 2023년 10월 20일 버전 1.0 입니다. p.g. 596의 '이중 우선순위 큐' 풀이1, 3 (이중 구조 방식)에 질문이 있어 문의 드립니다. 풀이1, 3 모두 언어의 차이(java, kotlin)만 있을 뿐, 모두 이중 구조 방식으로 풀이하고 있습니다. 하지만 값을 추출한 후, 대응하는 다른 힙의 엘리먼트를 삭제하는 ...

X Description: 제가 가지고 있는 전자책은 2023년 10월 20일 버전 1.0 입니다. p.g. 596의 '이중 우선순위 큐' 풀이1, 3 (이중 구조 방식)에 질문이 있어 문의 드립니다. 풀이1, 3 모두 언어의 차이(java, kotlin)만 있을 뿐, 모두 이중 구조 방식으로 풀이하고 있습니다. 하지만 값을 추출한 후, 대응하는 다른 힙의 엘리먼...

Opengraph URL: https://github.com/onlybooks/java-algorithm-interview/issues/4

X: @github

direct link

Domain: patch-diff.githubusercontent.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"p.g. 596의 '이중 우선순위 큐' 풀이1, 3 (이중 구조 방식)","articleBody":"제가 가지고 있는 전자책은 2023년 10월 20일 버전 1.0 입니다.\r\n\r\np.g. 596의 '이중 우선순위 큐' 풀이1, 3 (이중 구조 방식)에 질문이 있어 문의 드립니다.\r\n\r\n풀이1, 3 모두 언어의 차이(java, kotlin)만 있을 뿐, 모두 이중 구조 방식으로 풀이하고 있습니다.\r\n하지만 값을 추출한 후, 대응하는 다른 힙의 엘리먼트를 삭제하는 과정이 비효율적이라고 생각합니다.\r\n=\u003e 최대값 추출의 경우, 최대힙에서 최대값을 추출 후, 해당 값을 최소힙에서 remove() 메서드를 통해 제거\r\n=\u003e 최소값 추출의 경우, 최소힙에서 최소값을 추출 후, 해당 값을 최댜힙에서 remove() 메서드를 통해 제거\r\n\r\n우선순위 큐의 이점은 최대값과 최소값 추출을 O(log n)에 수행하여 완전탐색 O(n)에 비해 빠르다는 것이지만,\r\n이후, remove() 메서드를 사용하면 결국 시간복잡도 O(n)의 연산으로 우선순위 큐를 사용하는 의미가 사라집니다.\r\n\r\n전체 엘리먼트 관리를 아래와 같이 전체 엘리먼트 개수로 하게 되면, 값 추출의 시간복잡도가 O(log n)이 됩니다.\r\n```\r\nimport java.util.*\r\n\r\nclass Solution {\r\n    fun solution(operations: Array\u003cString\u003e): IntArray {\r\n        // 우선순위 큐 선언, 자바 기본은 최소 힙이므로 최대 힙으로 정렬 지정\r\n        val minHeap: Queue\u003cInt\u003e = PriorityQueue()\r\n        val maxHeap: Queue\u003cInt\u003e = PriorityQueue(Collections.reverseOrder())\r\n        var totalCnt = 0\r\n        // 명령어 목록을 하나씩 순회하면서 해당하는 작업 수행\r\n        operations\r\n            .map { it.split(\" \") }\r\n            .forEach { op -\u003e\r\n                // 삽입 연산\r\n                when (op[0]) {\r\n                    \"I\" -\u003e { // 추출 연산\r\n                        minHeap.add(op[1].toInt())\r\n                        maxHeap.add(op[1].toInt())\r\n                        totalCnt++\r\n                    }\r\n\r\n                    \"D\" -\u003e { // 삭제 연산\r\n                        if (totalCnt \u003e 0) {\r\n                            when (op[1]) {\r\n                                // 값이 1인 경우 최댓값 추출\r\n                                \"1\" -\u003e maxHeap.poll()\r\n                                // 값이 -1인 경우 최솟값 추출\r\n                                \"-1\" -\u003e minHeap.poll()\r\n                            }\r\n                            if (--totalCnt == 0) {\r\n                                maxHeap.clear()\r\n                                minHeap.clear()\r\n                            }\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n\r\n        // 최종결과인 최댓값과 최솟값을 추출하고 값이 없다면 0, 아니라면 해당 값으로 리턴\r\n        return intArrayOf(\r\n            maxHeap.poll() ?: 0,\r\n            minHeap.poll() ?: 0\r\n        )\r\n    }\r\n}\r\n```\r\n\r\n검토 부탁드리며, 혹시 저의 의견중 틀린 부분이 있으면 알려주시면 감사하겠습니다.","author":{"url":"https://github.com/hoogom88","@type":"Person","name":"hoogom88"},"datePublished":"2024-02-16T06:21:34.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/4/java-algorithm-interview/issues/4"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:41ac6bfe-165a-8342-c312-41518b755b34
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA42C:F6370:53ADD14:71FE0B4:697825B4
html-safe-nonce293e5b2aaab5c0e0fdfee9eec781feb1e9ca34fc615f74ca4e3252f3677099df
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNDJDOkY2MzcwOjUzQUREMTQ6NzFGRTBCNDo2OTc4MjVCNCIsInZpc2l0b3JfaWQiOiIyODA1MzM0Nzc1MzYxNDQ3MzQ4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacb142b45068ee376f14bd06d59a38b4986e22715c024a3b54f490a9fc49986bca
hovercard-subject-tagissue:2137950906
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/onlybooks/java-algorithm-interview/4/issue_layout
twitter:imagehttps://opengraph.githubassets.com/aabfb31cc569060277b22ba0d42cd7fd914ad53d2551504b7f0a14b7b90a0882/onlybooks/java-algorithm-interview/issues/4
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/aabfb31cc569060277b22ba0d42cd7fd914ad53d2551504b7f0a14b7b90a0882/onlybooks/java-algorithm-interview/issues/4
og:image:alt제가 가지고 있는 전자책은 2023년 10월 20일 버전 1.0 입니다. p.g. 596의 '이중 우선순위 큐' 풀이1, 3 (이중 구조 방식)에 질문이 있어 문의 드립니다. 풀이1, 3 모두 언어의 차이(java, kotlin)만 있을 뿐, 모두 이중 구조 방식으로 풀이하고 있습니다. 하지만 값을 추출한 후, 대응하는 다른 힙의 엘리먼트를 삭제하는 ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamehoogom88
hostnamegithub.com
expected-hostnamegithub.com
None2981c597c945c1d90ac6fa355ce7929b2f413dfe7872ca5c435ee53a24a1de50
turbo-cache-controlno-preview
go-importgithub.com/onlybooks/java-algorithm-interview git https://github.com/onlybooks/java-algorithm-interview.git
octolytics-dimension-user_id36435243
octolytics-dimension-user_loginonlybooks
octolytics-dimension-repository_id684433808
octolytics-dimension-repository_nwoonlybooks/java-algorithm-interview
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id684433808
octolytics-dimension-repository_network_root_nwoonlybooks/java-algorithm-interview
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8cc3e064910e26648760f573a358cfc07c97b42c
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/onlybooks/java-algorithm-interview/issues/4#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fonlybooks%2Fjava-algorithm-interview%2Fissues%2F4
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fonlybooks%2Fjava-algorithm-interview%2Fissues%2F4
Sign up https://patch-diff.githubusercontent.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=onlybooks%2Fjava-algorithm-interview
Reloadhttps://patch-diff.githubusercontent.com/onlybooks/java-algorithm-interview/issues/4
Reloadhttps://patch-diff.githubusercontent.com/onlybooks/java-algorithm-interview/issues/4
Reloadhttps://patch-diff.githubusercontent.com/onlybooks/java-algorithm-interview/issues/4
onlybooks https://patch-diff.githubusercontent.com/onlybooks
java-algorithm-interviewhttps://patch-diff.githubusercontent.com/onlybooks/java-algorithm-interview
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2Fonlybooks%2Fjava-algorithm-interview
Fork 26 https://patch-diff.githubusercontent.com/login?return_to=%2Fonlybooks%2Fjava-algorithm-interview
Star 110 https://patch-diff.githubusercontent.com/login?return_to=%2Fonlybooks%2Fjava-algorithm-interview
Code https://patch-diff.githubusercontent.com/onlybooks/java-algorithm-interview
Issues 4 https://patch-diff.githubusercontent.com/onlybooks/java-algorithm-interview/issues
Pull requests 0 https://patch-diff.githubusercontent.com/onlybooks/java-algorithm-interview/pulls
Actions https://patch-diff.githubusercontent.com/onlybooks/java-algorithm-interview/actions
Projects 0 https://patch-diff.githubusercontent.com/onlybooks/java-algorithm-interview/projects
Security 0 https://patch-diff.githubusercontent.com/onlybooks/java-algorithm-interview/security
Insights https://patch-diff.githubusercontent.com/onlybooks/java-algorithm-interview/pulse
Code https://patch-diff.githubusercontent.com/onlybooks/java-algorithm-interview
Issues https://patch-diff.githubusercontent.com/onlybooks/java-algorithm-interview/issues
Pull requests https://patch-diff.githubusercontent.com/onlybooks/java-algorithm-interview/pulls
Actions https://patch-diff.githubusercontent.com/onlybooks/java-algorithm-interview/actions
Projects https://patch-diff.githubusercontent.com/onlybooks/java-algorithm-interview/projects
Security https://patch-diff.githubusercontent.com/onlybooks/java-algorithm-interview/security
Insights https://patch-diff.githubusercontent.com/onlybooks/java-algorithm-interview/pulse
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/onlybooks/java-algorithm-interview/issues/4
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/onlybooks/java-algorithm-interview/issues/4
p.g. 596의 '이중 우선순위 큐' 풀이1, 3 (이중 구조 방식)https://patch-diff.githubusercontent.com/onlybooks/java-algorithm-interview/issues/4#top
https://github.com/hoogom88
https://github.com/hoogom88
hoogom88https://github.com/hoogom88
on Feb 16, 2024https://github.com/onlybooks/java-algorithm-interview/issues/4#issue-2137950906
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.