Hot answers tagged

22 votes
Accepted

Algorithm for merging arrays while keeping their order

You can easily solve your problem by creating a directed graph $G=(V,E)$ in which $V$ is the set of all characters that appear in some input string and $E$ contains the edge $(u,v)$ if character $u$ ...
user avatar
  • 23.4k
2 votes

Sampling unique records from a large dataframe

A reasonable approach would be to build a hashtable that stores all unique records. Scan through the records one at a time, adding each to the hashtable if it is not already present; if it already is ...
user avatar
  • 141k
1 vote

Permute rows of a matrix to minimize total number of inversions of its column vectors

While I do not have an answer, I have given this some thought and would like to share my ideas. I am making two simplifying assumptions but the general case shouldn't be much harder. All numbers are ...
user avatar
1 vote
Accepted

Compare solutions of counting sort

I think there are two important advantages of the original counting sort implementation. First, the original version can easily be modified in case the items (keys) being sorted includes additional ...
user avatar
  • 1,403

Only top scored, non community-wiki answers of a minimum length are eligible