I have a list of cities that have numerous incorrect spelling for the same city. One city is misspelled 18 times! I am trying to clean this up but its taking hours. Is there some algorithm that might "guess" at the valid city name for each of these misspelled ones? Some form of weighting? The data is in MySQL and I do have a table o...
I came across solution given at http://discuss.joelonsoftware.com/default.asp?interview.11.780597.8 using Morris InOrder traversal using which we can find the median in O(n) time.
But is it possible to acheive the same using O(logn) time? The same has been asked here - http://www.careercup.com/question?id=192816
...
I have a set of rectangles and arbitrary shape in 2D space. The shape is not necessary a polygon (it may be a circle), and rectangles have different widths and heights. The task is to approximate the shape with rectangles as close as possible. I can't change rectangles dimensions, but rotation is permitted.
It sounds very similar to pac...
In terms of runtime, what is the best known transitive closure algorithm for directed graphs?
I am currently using Warshall's algorithm but its O(n^3). Although, due to the graph representation my implementation does slightly better (instead of checking all edges, it only checks all out going edges). Is there any transitive closure algo...
I hope I can explain this well, if I don't I'll try again.
I want to generate an array of 5 random numbers that all add up to 10 but whose allocation are chosen on an interval of [0,2n/m].
I'm using numpy.
The code I have so far looks like this:
import numpy as np
n=10
m=5
#interval that numbers are generated on
randNumbers= np.rand...
i have a code from book like this :
<script type="text/javascript">
<!-- start hiding javascript
var randomNo = 0;
var gameOver = false;
var keepPlaying = true;
var guess = "";
var msg = "I'm thinking of a number between 1 to 10, can you guess it?";
var reply = "";
while ...
Hi,
I have an hour selection drop down 0-23 and minutes selection drop down 0-59 for Start time and End time respectively (so four controls).
I'm looking for an algorithm to calculate time difference using these four values.
Since they're not stored in fancy date/time selection controls, I don't think I can use any standard date/time ...
I have web-site and I need to create that step-by-step adds:
Selecting Country, city, etc
more information about project
Photos
Message/etc
How is correct to do these steps?
Get paraemtrs like step/1/ and get info from DB on every step, use $_SESSION(Save step num, info from prev.) or.. ?
in each step i need to get information from p...
I have a probability problem, which I need to simulate in a reasonable amount of time. In simplified form, I have 30 unfair coins each with a different known probability. I then want to ask things like "what is the probability that exactly 12 will be heads?", or "what is the probability that AT LEAST 5 will be tails?".
I know basic pr...
I am looking for a simple (pseudo)code that spectrum-inverse a sampled audio signal.
Ideally C++
The code should support different sample rates (16/32/48KHz).
...
Is there a library (in any language) that can search patterns in matrixes like regular expressions work for strings ? Something like regular expresions for matrixes, or any matrix pattern search method ?
...
I have a large directed, acylic graph (DAG) from which I would like to efficiently draw a sample node according to the following criteria:
I specify a fixed node A that must never be sampled
Nodes that directly or indirectly refer to A are never sampled
All other nodes are sampled with equal probability
Nodes are stored as objects wi...
When I was solving Euler project problem #15 I realized that it can be solved with the # of combinations of ways of the route from start to end. The route generated always has the same size of right or down choices (or 0s and 1s) and the right routes always have the same qty of 0s and 1s.
So qty of numbers with the same qty of 0s and 1s ...
Hi, I'm looking for a algorithim that can compute an approximation of the Kolmogorov complexity of given input string. So if K is the Kolmogorov complexity of a string S, and t represents time, then the function would behave something like this.. limit(t->inf)[K_approx(t,S)] = K.
...
Hi all,
I have a set of 3D boxes with arbitrary dimensions, translations and rotations.
I need to force the boxes not to intersect by scaling them by a single constant over their 3 dimension components.
At the moment I am doing this iteratively by checking for intersection and then reducing the scaling iteratively until there is no i...
First of all: this is not a homework assignment, it's for a hobby project of mine.
Background:
For my Java puzzle game I use a very simple recursive algorithm to check if certain spaces on the 'map' have become isolated after a piece is placed. Isolated in this case means: where no pieces can be placed in.
Current Algorithm:
public i...
The speed of Eudora and GMail for instance in looking through thousands of emails and finding the right set of messages amazes me. I use Eudora and the search is so blazing fast at running through ten years of emails within a few seconds.
So my question is, how do they store and retrieve messages? What data structures to store the data,...
I'm drawing 2D, concave, sometimes multicontoured, sometimes self intersecting polygons with OpenGL.
Here is a sample:
Right now, I take the points which if connected would result in the polygon's outline. Then I put these into the GLUTesselator where triangles come out. I then make texture coordinates and texture the polygon.
The abs...
Hi guys,
I would like to know the process and service providers who will enable me to send the validation text to users mobile in order to verify the user.
I have seen validation text from facebook that it sends to its users whenever validation is needed.
I would like to build similar system
...
Lets put some numbers first:
The largest of the list is about 100M records. (but is expected to grow upto 500). The other lists (5-6 of them) are in millions but would be less than 100M for the foreseeable future.
These are always joined based on a single id. and never with any other parameters.
Whats the best algorithm to join such list...