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
View 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 }}
HotWesley
Reference
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
main
Breadcrumbs
Reference
/
Programming Intermediate
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
35 lines (27 loc) · 1.57 KB
main
Breadcrumbs
Reference
/
Programming Intermediate
Copy path
Top
File metadata and controls
Code
Blame
35 lines (27 loc) · 1.57 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
21
22
23
24
25
26
27
28
29
30
31
32
33
34
1. List
완전 탐색
- 브루트 포스 기법이라고도 함
- 모든 경우의 수를 테스트하고 최종 해법을 도출함
- 일반적으로 경우의 수가 상대적으로 작을 때 유용함
- 모든 경우의 수를 생성하고 테스트 하기 때문에 수행 속도는 느리지만, 해답을 못찾을 확률은 적으
- 일단 완전 탐색으로 해답 도출한 후에 성능 개선을 위해 다른 알고리즘으로 확인하는 것이 바람직함
순열
- 서로 다른 것들 중 몇개를 뽑아서 한줄로 나열
- 1,2,3 을 포함하는 모든 순열을 생성하는 함수?
ex)
def permutations(array, r):
for i in range(len(array)):
if r == 1:
yield [array[i]]
else:
for next in permutations(array[:i] + array[i + 1:], r - 1):
yield [array[i]] + next
result = permutations([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 3)
그리디 알고리즘
- 최적해를 구하는데 사용되는 근시안적인 방법
- 여러 경우 중 하나를 결정해야 할 때마다 그 순간에 최적이라고 생각되는 것을 선택해 나가는 방식
- 하지만 최종적으로는 최적이라고 할 수 없음
- 해답을 찾아내지 못하는 경우도 있음. 유의해서 써야함
1) 현재 상태에서 부분 문제의 최적 해를 구한 뒤, 이를 부분해 집합에 추가
2) 새로운 부분 해 집합이 실행 가능한지를 확인. 문제의 제약 조건을 위반하지 않는지 검사
3) 새로운 부분에 집합이 문제의 해가 되는지 확인. 아니라면 해 선택부터 다시 시작
You can’t perform that action at this time.