Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

贪心算法,你入门了吗? #7035

Merged
merged 49 commits into from
May 13, 2020
Merged

贪心算法,你入门了吗? #7035

merged 49 commits into from
May 13, 2020

Conversation

chaingangway
Copy link
Contributor

译文翻译完成,resolve #7012

chaingangway and others added 30 commits March 30, 2020 10:05
This reverts commit afb007d.
* 8个值得了解的树形数据结构

8个值得了解的树形数据结构

* Update 8-Useful-Tree-Data-Structures-Worth-Knowing.md

* Update 8-useful-tree-data-structures-worth-knowing.md

Co-authored-by: sun <776766759@qq.com>
* 眼动跟踪和移动世界的最佳用户体验实践

翻译完成

* 眼动跟踪和移动世界的最佳用户体验实践 xitu#6806

谢谢指点~@xionglong58     @fanyijihua 根据第一轮校对意见修改完成

* 眼动追踪和移动世界的最佳用户体验实践

* 眼动追踪和移动世界的最佳用户体验实践
* 我并不讨厌箭头函数(xitu#6610)

* 我并不讨厌箭头函数(xitu#6610) - 根据校对结果修改

* Update i-dont-hate-arrow-functions.md

Co-authored-by: 小添 <xiaotian@qunhemail.com>
Co-authored-by: sun <776766759@qq.com>
* 掌握 JavaScript 面试:什么是纯函数?

掌握 JavaScript 面试:什么是纯函数?

* Update master-the-javascript-interview-what-is-a-pure-function.md

* Update master-the-javascript-interview-what-is-a-pure-function.md

* Update master-the-javascript-interview-what-is-a-pure-function.md

* Update master-the-javascript-interview-what-is-a-pure-function.md

* Update master-the-javascript-interview-what-is-a-pure-function.md

* Update master-the-javascript-interview-what-is-a-pure-function.md

* Update master-the-javascript-interview-what-is-a-pure-function.md

Co-authored-by: lsvih <lsvih@qq.com>
* translate(*): Part.1

* translate(*): Part.2

* translate(*): 完成翻译

* fix(*): 完成校对
* Create generator-functions-in-javascript.md

* Update generator-functions-in-javascript.md
)

* Create how-to-keep-your-dependencies-secure-and-up-to-date.md

* Update how-to-keep-your-dependencies-secure-and-up-to-date.md
* Create deep-dive-into-react-fiber-internals.md

* Update deep-dive-into-react-fiber-internals.md

* Update deep-dive-into-react-fiber-internals.md
…y.md (xitu#6847)

* Create how-can-cloud-services-help-improve-your-businessess-efficiency.md

* Update how-can-cloud-services-help-improve-your-businessess-efficiency.md
* Achieve translation

* 8 个值得了解的树形数据结构 (xitu#6804)

* 8个值得了解的树形数据结构

8个值得了解的树形数据结构

* Update 8-Useful-Tree-Data-Structures-Worth-Knowing.md

* Update 8-useful-tree-data-structures-worth-knowing.md

Co-authored-by: sun <776766759@qq.com>

* 眼动跟踪和移动世界的最佳用户体验实践 (xitu#6806)

* 眼动跟踪和移动世界的最佳用户体验实践

翻译完成

* 眼动跟踪和移动世界的最佳用户体验实践 xitu#6806

谢谢指点~@xionglong58     @fanyijihua 根据第一轮校对意见修改完成

* 眼动追踪和移动世界的最佳用户体验实践

* 眼动追踪和移动世界的最佳用户体验实践

* 我并不讨厌箭头函数(xitu#6610) (xitu#6659)

* 我并不讨厌箭头函数(xitu#6610)

* 我并不讨厌箭头函数(xitu#6610) - 根据校对结果修改

* Update i-dont-hate-arrow-functions.md

Co-authored-by: 小添 <xiaotian@qunhemail.com>
Co-authored-by: sun <776766759@qq.com>

* 掌握 JavaScript 面试:什么是纯函数? (xitu#6828)

* 掌握 JavaScript 面试:什么是纯函数?

掌握 JavaScript 面试:什么是纯函数?

* Update master-the-javascript-interview-what-is-a-pure-function.md

* Update master-the-javascript-interview-what-is-a-pure-function.md

* Update master-the-javascript-interview-what-is-a-pure-function.md

* Update master-the-javascript-interview-what-is-a-pure-function.md

* Update master-the-javascript-interview-what-is-a-pure-function.md

* Update master-the-javascript-interview-what-is-a-pure-function.md

* Update master-the-javascript-interview-what-is-a-pure-function.md

Co-authored-by: lsvih <lsvih@qq.com>

* Address comments

Co-authored-by: Amberlin1970 <37952468+Amberlin1970@users.noreply.github.com>
Co-authored-by: sun <776766759@qq.com>
Co-authored-by: Charlo <49369951+Charlo-O@users.noreply.github.com>
Co-authored-by: TiaossuP <tiaossup@yeah.net>
Co-authored-by: 小添 <xiaotian@qunhemail.com>
Co-authored-by: niayyy <yy761706@gmail.com>
Co-authored-by: lsvih <lsvih@qq.com>
* Update 5-secret-features-of-json-stringify.md

* Update 5-secret-features-of-json-stringify.md

* Update 5-secret-features-of-json-stringify.md

* Update 5-secret-features-of-json-stringify.md
* Create high-speed-inserts-with-mysql.md

* Update high-speed-inserts-with-mysql.md
* Update composing-software-the-book.md

* Update composing-software-the-book.md
* Create 6-best-javascript-frameworks-in-2020.md

* Update 6-best-javascript-frameworks-in-2020.md

* Update 6-best-javascript-frameworks-in-2020.md
* translation complete

* Update a-realworld-comparison-of-front-end-frameworks-2020.md

按照建议修改完成

* Update a-realworld-comparison-of-front-end-frameworks-2020.md

又修改了下破折号的格式

* Update a-realworld-comparison-of-front-end-frameworks-2020.md

修改了二级标题的显示问题

* Update a-realworld-comparison-of-front-end-frameworks-2020.md

添加相关个人信息

* Update a-realworld-comparison-of-front-end-frameworks-2020.md

Co-authored-by: lsvih <lsvih@qq.com>
* Create the-importance-of-why-docs.md

* Update the-importance-of-why-docs.md
* Update the-dao-of-immutability.md

* Update the-dao-of-immutability.md

* Update the-dao-of-immutability.md

* Update the-dao-of-immutability.md

* Update the-dao-of-immutability.md

* Update the-dao-of-immutability.md

Co-authored-by: lsvih <lsvih@qq.com>
* Create polymorphic-react-components.md

* Update polymorphic-react-components.md

* Update polymorphic-react-components.md

* Update polymorphic-react-components.md
* Create kafka-vs-rabbitmq-why-use-kafka.md

* Update kafka-vs-rabbitmq-why-use-kafka.md
…20.md (xitu#6876)

* Create i-built-an-app-that-uses-all-7-new-features-in-javascript-es2020.md

* Update i-built-an-app-that-uses-all-7-new-features-in-javascript-es2020.md

* Update i-built-an-app-that-uses-all-7-new-features-in-javascript-es2020.md

* Update i-built-an-app-that-uses-all-7-new-features-in-javascript-es2020.md
* Update how-can-cloud-services-help-improve-your-businessess-efficiency.md

* Update how-can-cloud-services-help-improve-your-businessess-efficiency.md: revise according to proofreading suggestions

* Update how-can-cloud-services-help-improve-your-businessess-efficiency.md: revise according to Yinjias proofreading suggestions
* NestJS 实现基本用户认证和会话

NestJS 实现基本用户认证和会话

* fix:修改 NestJS 实现基本用户认证和会话

根据校对者意见,修改 NestJS 实现基本用户认证和会话

* Update nestjs-basic-auth-and-sessions.md

Co-authored-by: lsvih <lsvih@qq.com>
* 更新测试

* Revert "更新测试"

This reverts commit afb007d.

* 作为2020年的开发者,你应该学习 VIM 吗?

* 校对更新

* 第二次校对修改

* 第三次校对修改

* Update TODO1/should-you-learn-vim-as-a-developer-in-2020.md

数字格式调整

Co-Authored-By: lsvih <lsvih@qq.com>

* Update TODO1/should-you-learn-vim-as-a-developer-in-2020.md

标题数字格式调整

Co-Authored-By: lsvih <lsvih@qq.com>

* 增加校对者名单

* 调整行数

* Update should-you-learn-vim-as-a-developer-in-2020.md

Co-authored-by: lsvih <lsvih@qq.com>
* Finish translation

* Addressed comments

* 添加校对者信息

* Remove content with english
@stuchilde
Copy link
Contributor

认领校对

@lsvih
Copy link
Member

lsvih commented May 9, 2020

@todaycoder001 好的~

@gaopinghai
Copy link
Contributor

校对认领 @fanyijihua

@lsvih
Copy link
Member

lsvih commented May 9, 2020

@PingHGao 好的

@lsvih lsvih removed the 校对认领 label May 9, 2020
Copy link
Contributor

@gaopinghai gaopinghai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

校对完成 @chaingangway @lsvih

article/2020/greedy-algorithms-101.md Show resolved Hide resolved
article/2020/greedy-algorithms-101.md Outdated Show resolved Hide resolved
article/2020/greedy-algorithms-101.md Outdated Show resolved Hide resolved
article/2020/greedy-algorithms-101.md Outdated Show resolved Hide resolved
article/2020/greedy-algorithms-101.md Outdated Show resolved Hide resolved
article/2020/greedy-algorithms-101.md Outdated Show resolved Hide resolved
article/2020/greedy-algorithms-101.md Outdated Show resolved Hide resolved
article/2020/greedy-algorithms-101.md Show resolved Hide resolved
article/2020/greedy-algorithms-101.md Show resolved Hide resolved
article/2020/greedy-algorithms-101.md Outdated Show resolved Hide resolved
@lsvih lsvih added the Tag 一次校对修改完成 label May 11, 2020
@lsvih lsvih merged commit 6598b7e into xitu:master May 13, 2020
@lsvih
Copy link
Member

lsvih commented May 13, 2020

@chaingangway 已经 merge 啦~ 快快麻溜发布到掘金然后给我发下链接,方便及时添加积分哟。

掘金翻译计划有自己的知乎专栏,你也可以投稿哈,推荐使用一个好用的插件
专栏地址:https://zhuanlan.zhihu.com/juejinfanyi

@lsvih lsvih added 翻译完成 and removed Tag 一次校对修改完成 正在校对 labels May 13, 2020
@lsvih
Copy link
Member

lsvih commented May 13, 2020

@todaycoder001 抱歉没注意到您还没提交意见 🤦 。。刚才读了一遍觉得没啥问题就条件反射 Approve 了

Copy link
Contributor

@stuchilde stuchilde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@todaycoder001 抱歉没注意到您还没提交意见 🤦 。。刚才读了一遍觉得没啥问题就条件反射 Approve 了

没事的哈,也怪我,好几天了还没修改完,我今天之内应该可以修改完。

article/2020/greedy-algorithms-101.md Show resolved Hide resolved
article/2020/greedy-algorithms-101.md Show resolved Hide resolved
article/2020/greedy-algorithms-101.md Show resolved Hide resolved
article/2020/greedy-algorithms-101.md Show resolved Hide resolved
article/2020/greedy-algorithms-101.md Show resolved Hide resolved
article/2020/greedy-algorithms-101.md Show resolved Hide resolved
article/2020/greedy-algorithms-101.md Show resolved Hide resolved
article/2020/greedy-algorithms-101.md Show resolved Hide resolved
@lsvih
Copy link
Member

lsvih commented May 13, 2020

@chaingangway 您先不着急发哈,等上面校对完了您再开个 pr 改吧

Copy link
Contributor

@stuchilde stuchilde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已经修改完毕


Sometimes what I personally do is use GitHub as a search engine and simply write the topic I’m looking for [[greedy algorithms](https://github.com/search?q=greedy+algorithm)].
有时,我个人也会把 GitHub 作为搜索引擎,并简单地写下我寻找的主题 [[贪心算法](https://github.com/search?q=greedy+algorithm)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

【有时,我个人也会把 GitHub 作为搜索引擎,并简单地写下我寻找的主题 [贪心算法]。】 => 【有时,我个人也会使用 GitHub 作为搜索引擎,并简单地写下我要找的主题 [贪心算法]。】


If you did like how Greedy algorithms work and now feel the urge to go and investigate more about them, pages like [Hackerrank](https://www.hackerrank.com/) or [Hackerearth](https://www.hackerearth.com/practice/) provide a huge amount of problems to solve, I’m sure you already knew about them but it is always good to mention 😊.
如果您喜欢贪心算法的工作原理,并且想深入研究,请访问 [Hackerrank](https://www.hackerrank.com/) 或者 [Hackerearth](https://www.hackerearth.com/practice/),这里有有很多要解决的问题,我相信您已经对它们有一定了解 😊。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

【如果您喜欢贪心算法的工作原理,并且想深入研究,请访问 Hackerrank 或者 Hackerearth,这里有有很多要解决的问题,我相信您已经对它们有一定了解 😊。】 => 【如果您确实喜欢贪心算法的工作原理,现在又想去研究一下它们,请访问 Hackerrank 或者 Hackerearth,这里有很多要解决的问题,我相信你已经知道了它们 😊。】


#### Solution
#### 解法
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

【解法】 => 【解决方案】

2. **Candidate:** The selected possible current solution to our problem
3. **Solution:** The first instance of the solution variable should simply be a data structure in which we will store our current solution to the problem.
4. **isSolution, candidatesLeft, removeCandidate, addCandidate, isGoodCandidate:** These are functions that we will also build, some of them, depending on the problem we are approaching, don’t even need to be whole functions but, for the shake of summarizing the schema, I decided to put them as functions.
1. **Candidates:** 所有可能的解集。它可以是任意的数据类型,但通常是可迭代的。在我们处理示例问题时,会加深对它的理解。现在请先记住结论 😁。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

【所有可能的解集。它可以是任意的数据类型,但通常是可迭代的。在我们处理示例问题时,会加深对它的理解。现在请先记住结论 😁。】=> 【该问题的可能解决方案列表。它可以是任意的数据类型,但通常是可迭代的。在我们处理示例问题时,你们会看得更清楚,现在先忍耐一下 😁。】

1. **Candidates:** 所有可能的解集。它可以是任意的数据类型,但通常是可迭代的。在我们处理示例问题时,会加深对它的理解。现在请先记住结论 😁。
2. **Candidate:** 在解集中,我们当前选中的一个解。
3. **Solution:** 解变量的第一个实例只需是一种数据结构,在这里我们将存储当前的解。
4. **isSolution, candidatesLeft, removeCandidate, addCandidate, isGoodCandidate:** 这些也是我们要创建的方法,其中的某些方法在一些实际问题中不必是完整的,但是为了总结代码模版,我把它们全部定义为方法。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

【这些也是我们要创建的方法,其中的某些方法在一些实际问题中不必是完整的,但是为了总结代码模版,我把它们全部定义为方法。】=> 【这些也是我们要构建的函数,其中一些函数,根据我们要解决的问题,甚至不需要是完整的函数,但是,为了总结模式,我决定将它们作为函数。】


```
solution
```

Then we see this main **while** loop with a couple of functions inside. Those functions must also be build but sometimes you don’t need a whole other function to see for example if you have left candidates to try.
然后,我们看一下这个 while 循环,它的循环条件中有两个方法。这些方法必须编写,但有时并不需要完整的方法体,例如,判断是否有剩余备选解的这个方法。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

【循环条件】 => 【循环】

@@ -87,29 +87,29 @@ if (isSolution(solution)) {
}
```

OK! so once we have seen the code and broadly explained it, I will give you a problem and you should try and solve it yourself. It is a very well known problem so you will easily find it on the internet but I recommend giving it a try.
至此我们已经看完了代码并对其进行了粗略的解释,现在我给您出道题,请您尝试自己解答。这是一个众所周知的问题,在网上很容易就能搜到答案,但我建议您还是尝试自己解决。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

【至此】 => 【至此,】

@lsvih
Copy link
Member

lsvih commented May 13, 2020

@chaingangway 楼上校对完了,您参考一下他的意见再开个 pr 把。。给您添麻烦了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

贪心算法,你入门了吗?