Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 45343

In mathematics and computer science, an algorithm is an effective method expressed as a finite list of well-defined instructions for calculating a function. Algorithms are used for calculation, data processing, and automated reasoning.

2 votes

What is the algorithm to copy a region of one bitmap, into a region in another?

In order to resize an image properly (particularly, to reduce the size of an image), you need an interpolation filter scaled to the smaller of the source and destination sizes. Unfortunately, if your …
comingstorm's user avatar
  • 2,737
6 votes

What are the best algorithms out there to retrieve data from a file system?

The short version: absent unusual circumstances, you should use a single-threaded traversal. As @CodesInChaos says, your computer is likely to be I/O bound in both phases of your task: size-checkin …
comingstorm's user avatar
  • 2,737
9 votes

How to find the closest vector to a given vector?

If you have multiple queries, you can use a spatial datastructure to accelerate them. This typically requires preprocessing your target points, and in any case will cost you some time and space. The …
comingstorm's user avatar
  • 2,737
1 vote

Do real-world algorithms that greatly outperform in the class below exist?

The simplex method for linear programming can be exponential in the worst case, while relatively new interior point algorithms can be polynomial. … (There are now more modern interior point algorithms which are competitive -- but the simplex method is, too...) …
2 votes
Accepted

Figuring a max repetitive sub-tree in an object tree

You can hash your sub-trees: for each node, generate a hash value based on the values of interest (i.e., excluding leaf values) and the hash values of its children, in order. Use this hash to insert …
comingstorm's user avatar
  • 2,737
2 votes
Accepted

Resolving equivalence relations

You probably want a disjoint set datastructure. This yields near-constant amortized performance per operation, and can be made very efficient for the kind of task you describe. Briefly, each equival …
comingstorm's user avatar
  • 2,737
8 votes
Accepted

Distance from point to n-dimensional line

If you use vector algebra (which is easy with a vector algebra library), there is no real difference between the 3-d case and the N-d case. Unfortunately, the page you link to has written out the vec …
comingstorm's user avatar
  • 2,737
1 vote

Why is quicksort better than other sorting algorithms in practice?

The actual performance of algorithms depends on the platform, as well as the language, the compiler, programmer attention to implementation detail, specific optimization effort, et cetera. … Over time, as the dominant platform changes, different algorithms may gain or lose their (ill-defined) relative advantage. …
comingstorm's user avatar
  • 2,737
5 votes
Accepted

How/where to run the algorithm on large dataset?

The nice thing about the PageRank algorithm is that it can be solved iteratively in a distributed way, within the MapReduce framework. However, the working data for Pagerank on ~5M nodes and ~50M edg …
comingstorm's user avatar
  • 2,737
4 votes
Accepted

How to discriminate from two nodes with identical frequencies in a Huffman's tree?

If your assignment doesn't specify how to discriminate between identical frequencies, then the compression format is underspecified, and you generally can't expect independent implementations to inter …
comingstorm's user avatar
  • 2,737
1 vote

Data structure for determining intersection between line and polygon in 3D

If your scene is static (i.e., your triangles don't move, so you can amortize building your acceleration datastructure across all your lines), then I believe that a highly optimized kd-tree is still s …
comingstorm's user avatar
  • 2,737
0 votes

finding optimal token definitions for compression

Lempel-Ziv style compression does the kind of thing you're looking for. For your application, it sounds like you want a fixed "string dictionary" (LZ's internal representation of your token definitio …
comingstorm's user avatar
  • 2,737
2 votes

How to find local maxima in matrices?

If you want to lump together neighbors with equal values, you can use a disjoint-set (aka union-find) datastructure to efficiently categorize sets of equivalent neighbors. However, if your matrix val …
comingstorm's user avatar
  • 2,737