I have a system that requires a unique 6-digit code to represent an object, and I'm trying to think of a good algorithm for generating them. Here are the pre-reqs:
I'm using a base-20 system (no caps, numbers, vowels, or l to prevent confusion and naughty words)
The base-20 allows 64 million combinations
I'll be inserting potentially...
What is a good algorithm to make halftone images (like this)? A quick google search brings up a bunch of papers on the subject, but it's difficult to judge which are good, efficient, etc. Is there a best choice to do this sort of thing?
...
I have 2 arrays (A and B) that contain similar data with some differences. I would like to return an array of objects that are only in A and another array of objects that are only in B. So far I have been thinking:
Brute force with some optimizations (this is trivial)
Sort the arrays and use a binary search.
What are my other option...
Due to the difficulty for machine to represent floating point values exactly, we are using the a technique from Write Great Code: Understanding the machine to perform floating point comparisons:
from the editor: please insert your code here. See HTML comment in the question source
Currently, we hard coded the 'error' value. But the er...
I have a set of 3 dimensional points. I want a quick query of the k nearest neighbours of any of these points. I know that a usual way of doing this is oct-tree, however I think that with the below described data structure the query would be much faster.
I want a minimal graph on the points as vertices, which have the following proper...
I need a free(open-source) solution that given the lat/lng can return the closet city/state or zip. mysql is not an option, a small lightweight database would be the best if possible.
Updates: No web services, with 50 million impressions a day even the smallest addon hurts so adding a service request would kill response time. I would ...
This is NOT a homework. I'm a beginner in programming, and also this is my first post here - please bear with me.
I was not able to find similar questions posted here.
In a beginner's book, I found the following issue:
# Find the biggest area of adjacent numbers in this matrix:
1 3 2 2 2 4
3 3 3 2 4 4
4 3 1 2 3 3 #--> 13 times '3'
4...
Can anyone point to best algorithm for substring search in another string?
or search for a char array in another char array?
...
I'm trying to build a sequence that determines the order to destroy objects. We can assume there are no cycles. If an object A uses an object B during its (A's) construction, then object B should still be available during object A's destruction. Thus the desired order of destruction is A, B. If another object C uses object B during its (...
I'd like some kind of string comparison function that preserves natural sort order1. Is there anything like this built into Java? I can't find anything in the String class, and the Comparator class only knows of two implementations.
I can roll my own (it's not a very hard problem), but I'd rather not re-invent the wheel if I don't hav...
I have a rather mathematical problem I need to solve:
The task is to cut a predefined number of tubes out of fixed length tubes with a minimum amount of waste material.
So let's say I want to cut 10 1m tubes and 20 2,5m tubes out of tubes with a standardized length of 6m.
I'm not sure what an algorithm for this kind of problem would l...
What I want to accomplish is a tool that filters my files replacing the occurrences of strings in this format ${some.property} with a value got from a properties file (just like Maven's or Ant's file filtering feature).
My first approach was to use Ant API (copy-task) or Maven Filtering component but both include many unnecessary depend...
I wanted to evaluate performance comparisons for various approaches to solving the N queens problem. Mainly AI metaheuristics based algorithms like simulated annealing, tabu search and genetic algorithm etc compared to exact methods(like backtracking). Is there any code available for study? A lot of real-world optimization problems like ...
I'm looking for an algorithm to solve the following in a reasonable amount of time.
Given a set of sets, find all such sets that are subsets of a given set.
For example, if you have a set of search terms like ["stack overflow", "foo bar", ...], then given a document D, find all search terms whose words all appear in D.
I have found tw...
Hi,
Does somebody know the algorithm that is been used to fill or draw a Path2D (GraphicsPath in .NET) object with a Graphics2D-object (Graphics in .NET). The algorithm isn't public in the Java-sources and .NET isn't public at all. I want to use it for some fast image-operations.
Thnx
...
I have written an implementation of the A* search algorithm. The problem is that the heuristic I'm currently using only works accurately on square grids. As my map is isometric, the heuristic doesn't take into account actual the layout of the map and thus, the distance between cells.
Update: After extensive logging and analysis (read as...
vector<int>::iterator it;
vector<int> p;
p.push_back(4);
p.push_back(5);
p.push_back(6);
p.push_back(7);
it = p.begin() + 2;
cout << it << endl;
Is this O(N) or O(1)? And why?
...
From the Oracle docs.
A number representing one or more statistics class. The following class numbers are additive:
1 - User
2 - Redo
4 - Enqueue
8 - Cache
16 - OS
32 - Real Application Clusters
64 - SQL
128 - Debug
It there a standard solution for taking say 22 and decoding that into 16, 4, and 2? My first guess ...
I am thinking of starting a project which is based on recommandation system. I need to improve myself at this area which looks like a hot topic on the web side. Also wondering what is the algorithm lastfm, grooveshark, pandora using for their recommendation system. If you know any book, site or any resource for this kind of algorithms pl...
I need to quickly save a re-ordered sequence back to my items' integer sortOrder columns.
The simple renumber-by-one approach can be slow - if last item moved to first, all N rows are modified. A multi-row update statement would let database do the work, but I'd like to explore smarter ways, like making sortOrder floating point except...