Algorithm
Algorithms are detailed sets of guidelines created for a computer program to complete tasks efficiently and thoroughly.
Here are 845 public repositories matching this topic...
Hey Yangshun,
Thanks for the great list of guides!
I found the explanation for Snake game bit difficult to follow and I came across this interesting and better explanantion here https://www.youtube.com/watch?v=AaGK-fj-BAM
有一幅以二维整数数组表示的图画,每一个整数表示该图画的像素值大小,数值在 0 到 65535 之间。
给你一个坐标 (sr, sc) 表示图像渲染开始的像素值(行 ,列)和一个新的颜色值 newColor,让你重新上色这幅图像。
为了完成上色工作,从初始坐标开始,记录初始坐标的上下左右四个方向上像素值与初始坐标相同的相连像素点,接着再记录这四个方向上符合条件的像素点与他们对应四个方向上像素值与初始坐标相同的相连像素点,……,重复该过程。将所有有记录的像素点的颜色值改为新的颜色值。
最后返回经过上色渲染后的图像。
示例 1:
输入:
image = [[1,1,1],[1,1,0],[1,0,1]]
sr = 1, sc = 1, newColor = 2
输出: [[2,2,2],[2,2,0],[2,0,1]]
解析:
在图像的正中间,(坐标(
Selection Sort, for example, makes the algorithm look extremely (impossibly) good at first glance - O(n) - because it's not showing the majority of the steps.
Instead of
for (var j = i + 1; j < D.length; j++) {
if (D[j] < D[minJ]) {
tracer._select(j);
minJ = j;
tracer._deselect(j);
}
}
it has to be more like
for (var j
Hey @mgechev,
I noticed that you have a README.md file in src/sorting, which has the Big O complexity for all algorithms. It also has the "When to use" column, which is blank. Basecs already has many algorithms' explanations, and can be used to fill in this.column. The explanations are valid for most languages and are concise.
Also, a README.md for all src/* folders would be helpful. (I would
-
Updated
May 18, 2020 - JavaScript
-
Updated
Apr 10, 2020 - JavaScript
-
Updated
Oct 14, 2019 - JavaScript
@redblobgames I'm wondering whether we could drop the script { display: block; } hack — while it's definitely cool, it has some drawbacks:
- We can't add code highlighting to the code (e.g. with https://highlightjs.org/), which would help docs readability a lot.
- We have to split the code into two files entangled together, which makes refactoring inconvenient.
- It's impossible to lint it
-
Updated
May 9, 2020 - JavaScript
When pinch-zooming on leaflet I do a clusters recalculation like so:
const clusterizedMarkers = index.getClusters(clustersBounds, zoom);
The zoom has sometimes non integer values coming from Leaflet:
From my console: zoom value – 8.383082795293051
At that moment, index.getClusters crashes the app as the zoom value is not an integer (which makes sense!)
The fix in that case is to chang
-
Updated
Apr 14, 2020 - JavaScript
benchmark
It'd be neat to have a benchmark to test our diffing needs — perf is a feature, and we should be able to catch regressions.
Given this would need to run in the browser, we'd probably need some tooling around this. I was thinking it'd be cool to run a headless Chrome instance through puppeteer, and use the [nanobench](https://github.com/mafintosh/nano
7 algorithms and data structures every programmer must know
Link above in readme has outdated link and website does not work.
-
Updated
Feb 25, 2020 - JavaScript
-
Updated
May 13, 2020 - JavaScript
-
Updated
Jul 6, 2017 - JavaScript
-
Updated
Apr 16, 2020 - JavaScript
-
Updated
Aug 18, 2019 - JavaScript
-
Updated
Apr 23, 2020 - JavaScript
-
Updated
Mar 26, 2020 - JavaScript
Describe the solution you'd like
until now the dashboards were added manually, I'd like them to be added in the deployment process automatically
-
Updated
Feb 13, 2020 - JavaScript
-
Updated
Sep 4, 2018 - JavaScript
- Wikipedia
- Wikipedia
https://github.com/trekhleb/javascript-algorithms/blob/master/src/algorithms/sets/cartesian-product/cartesianProduct.js#L8
I think it makes more sense to return an empty array