We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e5bd4b7 commit 3901188Copy full SHA for 3901188
src/runtimes/04-merge-sort.js
@@ -11,11 +11,9 @@ const assert = require('assert');
11
*/
12
function merge(a = [], b = []) {
13
const merged = [];
14
- let ai = 0;
15
- let bi = 0;
16
// merge elements on a and b in asc order. Run-time O(a + b)
17
for (let ai = 0, bi = 0; ai < a.length || bi < b.length;) {
18
- if(ai >= a.length || a[ai] > b[bi]) {
+ if (ai >= a.length || a[ai] > b[bi]) {
19
merged.push(b[bi++]);
20
} else {
21
merged.push(a[ai++]);
0 commit comments