Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbbfebd0

Browse files
committed
Fix linting errors
1 parentfed9e0e commitbbfebd0

File tree

5 files changed

+42
-41
lines changed

5 files changed

+42
-41
lines changed

‎src/data-structures/interval-tree.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,11 @@
151151
returncontains(point,this.root);
152152
};
153153

154+
functionintersects(a,b){
155+
return(a[0]<=b[0]&&a[1]>=b[0])||(a[0]<=b[1]&&a[1]>=b[1])||
156+
(b[0]<=a[0]&&b[1]>=a[0])||(b[0]<=a[1]&&b[1]>=a[1]);
157+
}
158+
154159
functionintersectsHelper(interval,node){
155160
if(!node){
156161
returnfalse;
@@ -169,11 +174,6 @@
169174
returnresult;
170175
}
171176

172-
functionintersects(a,b){
173-
return(a[0]<=b[0]&&a[1]>=b[0])||(a[0]<=b[1]&&a[1]>=b[1])||
174-
(b[0]<=a[0]&&b[1]>=a[0])||(b[0]<=a[1]&&b[1]>=a[1]);
175-
}
176-
177177
/**
178178
* Checks or interval belongs to at least one intarval from the tree.<br><br>
179179
* Complexity: O(log N).

‎src/graphics/bresenham-line-drawing.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
(function(exports){
22
'use strict';
33

4+
/**
5+
* Draws (prints) the given coordinates
6+
*@param {number} x The first coordinate of the point
7+
*@param {number} y The second coordinate of the point
8+
*/
9+
functiondrawPoint(x,y){
10+
console.log(x,y);
11+
}
12+
413
/**
514
* Bresenham's line drawing algorithm.
615
* It has complexity O(n)
@@ -33,15 +42,6 @@
3342
}
3443
}
3544

36-
/**
37-
* Draws (prints) the given coordinates
38-
*@param {number} x The first coordinate of the point
39-
*@param {number} y The second coordinate of the point
40-
*/
41-
functiondrawPoint(x,y){
42-
console.log(x,y);
43-
}
44-
4545
exports.drawLine=drawLine;
4646

4747
}(typeofexports==='undefined' ?window :exports));

‎src/graphs/spanning-trees/prim.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,6 @@
7171
exports.Graph.prototype.prim=(function(){
7272
varqueue;
7373

74-
/**
75-
* Initialize the algorithm.
76-
*
77-
*@private
78-
*/
79-
functioninit(){
80-
queue=newHeap(compareEdges);
81-
}
82-
8374
/**
8475
* Used for comparitions in the heap
8576
*
@@ -94,6 +85,15 @@
9485
returnb.distance-a.distance;
9586
}
9687

88+
/**
89+
* Initialize the algorithm.
90+
*
91+
*@private
92+
*/
93+
functioninit(){
94+
queue=newHeap(compareEdges);
95+
}
96+
9797
returnfunction(){
9898
init.call(this);
9999
varinTheTree={};

‎src/searching/binarysearch.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
(function(exports){
22
'use strict';
33

4+
functionid(val){returnval;}
5+
functionget(key){returnfunction(val){returnval[key];};}
6+
47
/**
58
* Searchs for specific element in a given array using
69
* the binary search algorithm.<br><br>
@@ -37,8 +40,6 @@
3740
}
3841
return-middle-1;
3942
}
40-
functionid(val){returnval;}
41-
functionget(key){returnfunction(val){returnval[key];};}
4243

4344
exports.binarySearch=binarySearch;
4445

‎src/sorting/quicksort.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,22 @@
1313
returna-b;
1414
}
1515

16+
/**
17+
* Swap the places of two elements
18+
*
19+
*@private
20+
*@param {array} array The array which contains the elements
21+
*@param {number} i The index of the first element
22+
*@param {number} j The index of the second element
23+
*@returns {array} array The array with swaped elements
24+
*/
25+
functionswap(array,i,j){
26+
vartemp=array[i];
27+
array[i]=array[j];
28+
array[j]=temp;
29+
returnarray;
30+
}
31+
1632
/**
1733
* Partitions given subarray using Lomuto's partitioning algorithm.
1834
*
@@ -35,22 +51,6 @@
3551
returnminEnd;
3652
}
3753

38-
/**
39-
* Swap the places of two elements
40-
*
41-
*@private
42-
*@param {array} array The array which contains the elements
43-
*@param {number} i The index of the first element
44-
*@param {number} j The index of the second element
45-
*@returns {array} array The array with swaped elements
46-
*/
47-
functionswap(array,i,j){
48-
vartemp=array[i];
49-
array[i]=array[j];
50-
array[j]=temp;
51-
returnarray;
52-
}
53-
5454
/**
5555
* Sorts given array.
5656
*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp