Title: 【041-week3】算法训练营第三周学习总结 · Issue #158 · algorithm002/algorithm · GitHub
Open Graph Title: 【041-week3】算法训练营第三周学习总结 · Issue #158 · algorithm002/algorithm
X Title: 【041-week3】算法训练营第三周学习总结 · Issue #158 · algorithm002/algorithm
Description: 图 DFS做number of islands比较简单,但是union find写起来非常好理解。 uionfind要注意find可以路径压缩,union可以用rank来减少树的最大深度。 堆和排序 看到光头哥找到中位数的代码非常简短,震惊了。原来可以用负数来把CPP的大顶堆转为小顶堆,不用额外自己定义,这主意相当不错。 堆主要用于排序,找到第K大元素,中位数,99百分数等。配合散列表,可以统计某些场合的10大热门关键词等。但堆排序没有快排快,所以平时需要还是尽量快排,...
Open Graph Description: 图 DFS做number of islands比较简单,但是union find写起来非常好理解。 uionfind要注意find可以路径压缩,union可以用rank来减少树的最大深度。 堆和排序 看到光头哥找到中位数的代码非常简短,震惊了。原来可以用负数来把CPP的大顶堆转为小顶堆,不用额外自己定义,这主意相当不错。 堆主要用于排序,找到第K大元素,中位数,99百分数等。配合散列表,可以...
X Description: 图 DFS做number of islands比较简单,但是union find写起来非常好理解。 uionfind要注意find可以路径压缩,union可以用rank来减少树的最大深度。 堆和排序 看到光头哥找到中位数的代码非常简短,震惊了。原来可以用负数来把CPP的大顶堆转为小顶堆,不用额外自己定义,这主意相当不错。 堆主要用于排序,找到第K大元素,中位数,99百分数等。配合散列表,可以...
Opengraph URL: https://github.com/algorithm002/algorithm/issues/158
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"【041-week3】算法训练营第三周学习总结","articleBody":"## 图\r\nDFS做number of islands比较简单,但是union find写起来非常好理解。\r\nuionfind要注意find可以路径压缩,union可以用rank来减少树的最大深度。\r\n## 堆和排序\r\n看到光头哥找到中位数的代码非常简短,震惊了。原来可以用负数来把CPP的大顶堆转为小顶堆,不用额外自己定义,这主意相当不错。\r\n堆主要用于排序,找到第K大元素,中位数,99百分数等。配合散列表,可以统计某些场合的10大热门关键词等。但堆排序没有快排快,所以平时需要还是尽量快排,C语言用qsort()即可。\r\n## DFS\r\n感觉DFS对树的遍历,图的遍历非常实用。\r\n写起来有种顺滑的感觉。\r\n## BFS\r\nqueue按层遍历已经慢慢熟悉了,但是总感觉没有DFS清晰。\r\nwhile循环前把第一个节点push到queue\r\n -\u003e到while循环里拿到q.size()\r\n -\u003efor循环开始遍历\r\n -\u003efor循环里拿到q.front(),再q.pop(),处理当前元素\r\n -\u003e下一层需要遍历的加到queue里去即可。\r\n-\u003e再到下一个while循环去遍历,直到所有都遍历完。\r\nvisited树不需要,图需要,但图里visited用的还不是很顺。。","author":{"url":"https://github.com/jianyuewu","@type":"Person","name":"jianyuewu"},"datePublished":"2019-06-21T11:41:50.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/158/algorithm/issues/158"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:123fde63-6cbc-4e5a-3f25-65e429a9f049 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BCC6:D449A:3717DE7:47F8485:696B9BE9 |
| html-safe-nonce | 00a00df13cc7cc1ee40d2d432397f67fb41eaa57617bcb39b6edb247b0ecae9d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQ0M2OkQ0NDlBOjM3MTdERTc6NDdGODQ4NTo2OTZCOUJFOSIsInZpc2l0b3JfaWQiOiI3NDY5NTgwMDE3OTg2MTQ5MzUzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 1cdb86f526b36d329a1b9f706e1c7228f5304557bd9cb52c122081e2a37c8974 |
| hovercard-subject-tag | issue:459155969 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/algorithm002/algorithm/158/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0589fc4e3e34ab7db2925bbd57ca1c516eaabd332da8f9a092b128847ac4b8e8/algorithm002/algorithm/issues/158 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0589fc4e3e34ab7db2925bbd57ca1c516eaabd332da8f9a092b128847ac4b8e8/algorithm002/algorithm/issues/158 |
| og:image:alt | 图 DFS做number of islands比较简单,但是union find写起来非常好理解。 uionfind要注意find可以路径压缩,union可以用rank来减少树的最大深度。 堆和排序 看到光头哥找到中位数的代码非常简短,震惊了。原来可以用负数来把CPP的大顶堆转为小顶堆,不用额外自己定义,这主意相当不错。 堆主要用于排序,找到第K大元素,中位数,99百分数等。配合散列表,可以... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jianyuewu |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d |
| turbo-cache-control | no-preview |
| go-import | github.com/algorithm002/algorithm git https://github.com/algorithm002/algorithm.git |
| octolytics-dimension-user_id | 50957709 |
| octolytics-dimension-user_login | algorithm002 |
| octolytics-dimension-repository_id | 188251266 |
| octolytics-dimension-repository_nwo | algorithm002/algorithm |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 188251266 |
| octolytics-dimension-repository_network_root_nwo | algorithm002/algorithm |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 82560a55c6b2054555076f46e683151ee28a19bc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width