I need to write an algorithm that returns the closest match for a contact based on the name and address entered by the user. Both of these are troubling, since there are so many ways to enter a company name and address, for instance:
Company A, 123 Any Street Suite 200, Anytown, AK 99012
Comp. A, 123 Any St., Suite 200, Anytown, AK 9901...
For a complex polygon (ie: self intersecting) the choice between the Winding or the Even-Odd filling rules makes a difference in the way the polygon is filled.
But for non intersecting polygons is there any performance difference between the Winding or the Even Odd filling rules. I understand it would be implentation specific but which ...
Given a very large database of product names, how would you detect possible typos in user searches and suggest possible corrections (Kinda like the way Google presents them)?
E.g.
User enters "fork handels" and presses 'search'.
They get back
"No results. Did you mean 'fork handles'?"
...
I'm drawing rectangles at random positions on the stage, and I don't want them to overlap.
So for each rectangle, I need to find a blank area to place it.
I've thought about trying a random position, verify if it is free with
private function containsRect(r:Rectangle):Boolean {
var free:Boolean = true;
for (var i:int = 0; i < ...
What is a plain English explanation of Big O? With as little formal definition as possible and simple mathematics.
...
Whenever I play Sudoko, I see the finished puzzle as an overspecified version of the original input. Like 8b/10b, Reed-Solomon codes, turbo codes, or low-density parity-check codes. With ECC the computer has to solve a puzzle to produce the correct data, and with Sudoku the human has to solve a puzzle to produce 81 digits of fun.
Do you...
My language is PHP, but the algorithm should be fairly universal.
I have an associative array of (let's say) ratings and number of times that rating has been given.
$ratings = array(
1 => 1,
2 => 3,
3 => 6,
4 => 3,
5 => 3
);
This is the equivalent of: [1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5], but given the...
I want to calculate the average of a set of angles. For example, I might have several samples from the reading of a compass. The problem of course is how to deal with the wraparound. The same algorithm might be useful for a clockface.
The actual question is more complicated - what do statistics mean on a sphere or in an algebraic space...
For a game I'm trying to determine the frequency that a certain # will show up at a given # of dice being rolled. I know... that question seems odd. Let me try to explain it with real numbers.
So, for 1 die, the frequency for each number will be identical. 1-6 will show up equal number of times.
Now for 2 dice, things get different. I ...
Given [1,2,3,4,5], how can i do something like 1/1, 1/2, 1/3,1/4,1/5, ...., 3/1,3/2,3/3,3/4,3/5,.... 5/1,5/2,5/3,5/4,5/5
I would like to store all the results, find the minimum, and return the two numbers used to find the minimum. So in the case i've described above i would like to return (1,5).
So basically I would like to do somethin...
I am a graduate student of physics and I am working on writing some code to sort several hundred gigabytes of data and return slices of that data when I ask for it. Here is the trick, I know of no good method for sorting and searching data of this kind.
My data essentially consists of a large number of sets of numbers. These sets can co...
Does anyone know of an algorithm to find if a linked list loops on itself using only two variables to traverse the list. Say you have a linked list of objects, it doesn't matter what type of object. I have a pointer to the head of the linked list in one variable and I am only given one other variable to traverse the list with.
So my...
Hello, ancient cryptography being one of my hobbies thanks to David Kahn's book The Codebreakers, I'm trying implement in Ruby classes to handle old ciphers such as the Nihilist cipher and ADFGVX. For these, one useful item is the Straddling checkboard. I have the following implementation in Ruby and would welcome any improvement.
cla...
I have a huge set of arbitrary natural language strings. For my tool to analyze them I need to convert each string to unique color value (RGB or other). I need color contrast to depend on string similarity (the more string is different from other, the more their respective colors should be different). Would be perfect if I would always g...
Friday afternoon seems like a good time to ask this question...
A while back I was trying to brute force a remote control which sent a 12 bit binary 'key'.
The device I made worked, but was very slow as it was trying every combination at about 50 bits per second (4096 codes = 49152 bits = ~16 minutes)
I opened the receiver and found i...
I'd like to populate the homepage of my user-submitted-illustrations site with the "hottest" illustrations uploaded.
Here are the measures I have available:
How many people have favourited that illustration
votes table includes date voted
When the illustration was uploaded
illustration table has date created
Number of comments (n...
Given two lists (not necessarily sorted), what is the most efficient non-recursive algorithm to find the intersection of those lists?
...
I have a huge (but finite) set of natural language strings.
I need a way to convert each string to a numeric value. For any given string the value must be the same every time.
The more "different" two given strings are, the more different two corresponding values should be. The more "similar" they are, the less different values should ...
I have a list of numeric values. I may normalize the values if needed.
I need to transform this list to a list of colors (in HSL, RGB or any other color model I can always do conversion later).
For any given value the color must be the same every time.
The more different two given numeric values are, the more contrast corresponding v...
I was working on implementing a quicksort yesterday, and then I ran it, expecting a faster runtime than the Mergesort (which I had also implemented). I ran the two, and while the quicksort was faster for smaller data sets <100 elements (and I did verify that it works), the mergesort became the quicker algorithm fairly quickly. I had been...