algorithm

Structure/algorithm for solving game with overlapping cards

Consider a card game along the lines of Tower Solitaire, Tripeaks, or Fairway Solitaire: the table consists of some number of cards which are immediately available, each of which might be covering other cards underneath it (blocking them from being played). You have one "foundation" card, and you can remove a card from the table if it's ...

Levenshtein questions

In the Levenshtein Distance algorithm, what does this line do?: d[i][j] = Minimum (d[i-1][j]+1, d[i][j-1]+1, d[i-1][j-1] + cost); Although it gets the minimum of all of those values, why is cost added to the end, and why do we have + 1 at the end of each array indexer (first two parameters)? ...

Minimum confidence and minimum support for Apriori

What are appropriate values for minimum confidence and minimum support values for the Apriori algorithm? How could you tweak them? Are they fixed values, or do they change during the running of the algorithm? If you have used this algorithm before, what values did you use? ...

How does Amazon's Statistically Improbable Phrases work?

How does something like Statistically Improbable Phrases work? According to amazon: Amazon.com's Statistically Improbable Phrases, or "SIPs", are the most distinctive phrases in the text of books in the Search Inside!™ program. To identify SIPs, our computers scan the text of all books in the Search Inside! program. If ...

Please help me find the official name of this programming approach.

I [surely re] invented this [wheel] when I wanted to compute the union and the intersection and diff of two sets (stored as lists) at the same time. Initial code (not the tightest): dct = {} for a in lst1: dct[a] = 1 for b in lst2: if b in dct: dct[b] -= 1 else: dct[b] = -1 union = [k for k in dct] inter = [k for k in dct...

Could anyone explain and/or post C code for the algorithm of advance kalman filter?

I need an explanation of advance kalman filter algorithm. Preferably a C code, but only the algorithm will work for me. ...

Why do Kruskal and Prim MST algorithms have different runtimes for sparse and dense graphs?

I am trying to understand why Prim and Kruskal have different time complexities when it comes to sparse and dense graphs. After using a couple of applets that demonstrate how each works, I am still left a little confused about how the density of the graph affects the algorithms. I hope someone could give me a nudge in the right directio...

Algorithm to parse a config file in php (Doxygen file)

hi, I have a conf file like this: http://pastie.org/768582 and my goal is to get in an array the comments and the key/value of each keys. array( array( 'comment' => "The PROJECT_NAME tag is a single", 'key' => "PROJECT_NAME", 'value' => "JMK", ), ) I would know what algoritm do I have to use? I have already tra...

Ask for resource about fast ray-tracing algorithm

Hi, All, First, I am sorry for this rough question, but I don't want to introduce too much details, so I just ask for related resource like articles, libraries or tips. My program need to do intensive computation of ray-triangle intersection (there are millions of rays and triangles), and my goal is to make it as fast as I can. What I...

Some MVVM questions (WPF C#)

I have been looking into MVVM recently and I seem to get the overall idea. There are a couple of niggly bits though that I do not fully understand and was hopping to get some answers here, cheers! Is it incorrect to use one data model for the whole application. Usually if I am creating a small utility I would have all of the logical da...

Need help in latent semantic indexing

Hi, I am sorry, if my question sounds stupid :) Can you please recommend me any pseudo code or good algo for LSI implementation in java? I am not math expert. I tried to read some articles on wikipedia and other websites about LSI ( latent semantic indexing ) they were full of math. I know LSI is full of math. But if i see some source co...

What are The opencv function useful for 2d skeleton estimation(ofRecursive centroids)

Possible Duplicate: Which is the best algorithm to Estimate and Visulize 2d skeleton using Opencv from the drawn contour Opencv functions or stepts for 2d skeleton estimation ...

An efficient technique to replace an occurence in a sequence with mutable or immutable state

I am searching for an efficient a technique to find a sequence of Op occurences in a Seq[Op]. Once an occurence is found, I want to replace the occurence with a defined replacement and run the same search again until the list stops changing. Scenario: I have three types of Op case classes. Pop() extends Op, Push() extends Op and Nop()...

Multi-dimensional filter to eliminate "bad" items from a large table?

I have a large table of N items with M (M>=3) distinct properties per item, From this table I have to remove all items for which the same table contains an item that scores equal or better on all properties. I have an algorithm (python) that solves it already, but it is output-sensitive and has a worst case of approx. O((n²+n)/2) when n...

How does Java efficiently search jar files for classes?

Suppose I have 500 jar files linked to my program totaling over 500 MB (size of all the jars, not each one) and my program makes a call to a class located in one of them. How does Java search through jars for a class, and what is the efficiency of this? O(n)? O(log(n))? ...

Find shortest combination of words that contain every character from a specified set.

Hey, I got an array (let's call it a1) of words (like "dog", "fish", "run", "programming" anything) that's really huge. I can combine any of the words out of a1 with any other of the words (e.g. you could combine "dog" and "programming" into "dog-programming"), and then again and again, until the strings gets really big. I also got an...

Algorithm complexity with input is fix-sized

I found some references about big O notation, but as far as I can understand algorithm complexity is a function of size of input data. For example, if complexity of bubble sort is O(n^2), n is the size of input array. Right? But, how can I determinate complexity of algorithm that has fixed input size and depends of values of input. For...

Algorithm to find optimal combination of products and shops to minimise cost.

Hello there Stackoverflow people, I run a site that finds its users the cheapest place to buy books. This is easy for a single book, but for multiple books it can sometimes be cheaper to purchase one book at one store and another book from another store. Currently I find the cheapest store that sells all books in the user's list, but I...

Currently known best algorithm(s) for computer chess ?

I just wanted to learn name of algorithms.. thanks ...

How can I sort a 10 x 10 grid of 100 car images in two dimensions, by price and speed?

Here's the scenario. I have one hundred car objects. Each car has a property for speed, and a property for price. I want to arrange images of the cars in a grid so that the fastest and most expensive car is at the top right, and the slowest and cheapest car is at the bottom left, and all other cars are in an appropriate spot in the grid...