Update implement-merge-sort.english.md (#29007)
This commit is contained in:
parent
82a58dc1b8
commit
a455b601dc
@ -7,7 +7,7 @@ challengeType: 2
|
||||
## Description
|
||||
<section id='description'>
|
||||
The next part of a good package.json is the description-field, where a short but informative description about your project belongs.
|
||||
If you some day plan to publishing a package to npm, remember that this is the string that should sell your idea to the user when they decide whether to install your package or not. However, that’s not the only use case for the description: Since it’s a great way to summarize what a project does, it’s just as important for your normal Node.js-projects to help other developers, future maintainers or even your future self understand the project quickly.
|
||||
If you some day plan to publish a package to npm, remember that this is the string that should sell your idea to the user when they decide whether to install your package or not. However, that’s not the only use case for the description: It’s a great way to summarize what a project does, it’s just as important for your normal Node.js-projects to help other developers, future maintainers or even your future self understand the project quickly.
|
||||
Regardless of what you plan for your project, a description is definitely recommended. Let’s add something similar to this:
|
||||
<code>"description": "A project that does something awesome",</code>
|
||||
Instructions
|
||||
|
@ -6,7 +6,7 @@ challengeType: 1
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
Another intermediate sorting algorithm that is very common is merge sort. Like quick sort, merge sort also uses a divide-and-conquer, recursive methodology to sort an array. It takes advantage of the fact that it is relatively easy to sort two arrays as long as each is sorted in the first place. But we'll start with only one array as input, so how do we get to two sorted arrays from that? Well, we can recursively divide the original input in two until we reach the base case of an array with one item. A single-item array is naturally sorted, so then we can start combining. This combination will unwind the recursive calls that split the original array, eventually producing a final sorted array of all the elements. The steps of merge sort, then, are:
|
||||
Another common intermediate sorting algorithm is merge sort. Like quick sort, merge sort also uses a divide-and-conquer, recursive methodology to sort an array. It takes advantage of the fact that it is relatively easy to sort two arrays as long as each is sorted in the first place. But we'll start with only one array as input, so how do we get to two sorted arrays from that? Well, we can recursively divide the original input in two until we reach the base case of an array with one item. A single-item array is naturally sorted, so then we can start combining. This combination will unwind the recursive calls that split the original array, eventually producing a final sorted array of all the elements. The steps of merge sort, then, are:
|
||||
<strong>1)</strong> Recursively split the input array in half until a sub-array with only one element is produced.
|
||||
<strong>2)</strong> Merge each sorted sub-array together to produce the final sorted array.
|
||||
Merge sort is an efficient sorting method, with time complexity of <i>O(nlog(n))</i>. This algorithm is popular because it is performant and relatively easy to implement.
|
||||
|
Loading…
x
Reference in New Issue
Block a user