Skip to content
#

Algorithm

Algorithms are detailed sets of guidelines created for a computer program to complete tasks efficiently and thoroughly.

Here are 7,588 public repositories matching this topic...

javascript-algorithms
knasim
knasim commented Aug 13, 2018

There is a better solution for the TwoSum problem than the hashmap solution. Sure hashmap is fine and meets the desired output. however it can be completely eliminated as such. The techinque employs a pointers to track the argument array i.e. one from the begining aka head and the other one from the end aka tail. A single sweep on the array and adjusting the two pointers does the job rath

wnesensohn
wnesensohn commented May 23, 2016

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
leetcode
azl397985856
azl397985856 commented Nov 11, 2019

给定两个由小写字母构成的字符串 A 和 B ,只要我们可以通过交换 A 中的两个字母得到与 B 相等的结果,就返回 true ;否则返回 false 。

 

示例 1:

输入: A = "ab", B = "ba"
输出: true
示例 2:

输入: A = "ab", B = "ab"
输出: false
示例 3:

输入: A = "aa", B = "aa"
输出: true
示例 4:

输入: A = "aaaaaaabc", B = "aaaaaaacb"
输出: true
示例 5:

输入: A = "", B = "aa"
输出: false
 

提示:

0 <= A.length <= 20000
0 <= B.length <= 20000
A 和 B 仅由小写字母构成。

来源:力扣(L

goswami-rahul
goswami-rahul commented Jun 27, 2018

I just noticed that links in README are relative. They don't work in PyPI site repo page. (And the cool algorithms logo don't show up). Should we make them absolute links, or is there a better way?
Also, how do we update this current version to PyPI?
@danghai @keon What's our progress with Sphinx?

BitYog
BitYog commented Nov 30, 2017

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

PizzaBrandon
PizzaBrandon commented Jan 2, 2019

A short (3 point) closed linestring (rare, but does happen) throws an exception in clean-coords due to the code assuming it's a polygon.

Problem occurs due to https://github.com/Turfjs/turf/blob/master/packages/turf-clean-coords/index.ts#L118 assuming the first and last points matching means it's a polygon.

This can also happen with a linestring that is cleaned to < 4 points. Discovered thi

You can’t perform that action at this time.