Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
See all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
minbros
coding-test-practice
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
main
Breadcrumbs
coding-test-practice
/
summaryc.txt
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
20 lines (17 loc) · 1.75 KB
main
Breadcrumbs
coding-test-practice
/
summaryc.txt
Copy path
Top
File metadata and controls
Code
Blame
20 lines (17 loc) · 1.75 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
아스키 코드와 관련된 함수는 ord()와 chr()로,
ord는 문자를 아스키 코드 값으로, chr은 아스키 코드를 문자로 바꿔준다.
예를 들어, ord("A") == 65, ord(65) == "A"이다.
파이썬에서는 문자열끼리 크기 비교를 할 수 있다. 크기 비교의 기준은 아스키 코드 값이라고 보면 된다.
예를 들어, 'H' > 'I'는 True로 반환된다. 여러 문자가 합쳐진 문자열끼리 비교할 경우,
첫 번째 문자가 같으면 두 번째 문자를 비교하는 식으로 진행된다.
최소 비용 신장 트리(MST)를 구하는 프림, 크루스칼 알고리즘은 모두 그리디 알고리즘이다.
프림 알고리즘은 임의의 한 점에서 출발해서 인접한 간선 중 최소 비용에 해당하는 간선을 고르면서
모든 정점을 방문하는 알고리즘으로, 이를 구현할 때는 최소 힙을 사용한다.
크루스칼 알고리즘은 모든 간선 중 비용이 가장 적은 간선부터 추출해 MST에 추가해 나간다.
만약 사이클이 발생했을 경우 해당 간선은 MST에서 제외되는 알고리즘으로,
이를 구현할 때는 union - find 알고리즘을 이용하는데 이는 '부모 노드'라는 개념을 이용한다.
초기 상태의 부모 노드는 각각 자기 자신이며 간선으로 인해 연결될 경우
연결된 노드는 부모 노드가 하나로 통일된다. 일반적으로는 번호가 낮은 값으로 통일된다.
그러므로 간선이 여러 개 연결됐다면 연결된 모든 노드의 부모 노드는 하나로 통일된다.
만약 어떤 간선을 추가했을 때 해당 간선을 이루는 두 노드의 부모 노드가 같다면,
사이클이 발생한 것이므로 해당 간선은 제외되는 원리이다.
You can’t perform that action at this time.