Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects, and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Developer articles
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
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 }}
algorithm002
algorithm
Repository navigation
Code
Issues
185
(185)
Pull requests
Actions
Projects
Security and quality
Insights
More
items
【033-week3】算法训练营第三周学习总结
#168
New issue
Copy link
New issue
Copy link
Open
Open
【033-week3】算法训练营第三周学习总结
#168
Copy link
Description
flamencoy
Issue body actions
本周主要学习了图、堆和排序、DFS、BFS。图这里相对难理解写,后面还需要多刷题练习~
堆和堆排序
堆:
是一种完全二叉树,每个节点的值都大于等于(或小于等于)其子树节点的值。
适合用数组来存储。
堆排序:
将待排序序列构造成一个大顶堆。每次都取堆顶的元素,将其放在序列最后面,然后将剩余的元素重新调整为最大堆,依次类推,最终得到排序的序列,此时,整个序列的最大值就是堆顶的根节点。
堆排序时间复杂度:O(nlogn)
堆排序是一种选择排序,不稳定
DFS和BFS
BFS借助队列,从起点开始依次往外层遍历,适合搜索最短路径等;DFS借助栈,运用回溯思想,通常使用递归实现,适合搜索全部的解。
BFS和DFS仅适用于图不大的搜索
Activity
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Metadata
Metadata
Assignees
No one assigned
Labels
No labels
No labels
Type
No type
Projects
No projects
Milestone
No milestone
Relationships
None yet
Development
No branches or pull requests
Issue actions
Open in GitHub Copilot app
You can’t perform that action at this time.
Activity