I'm working on a script that takes the elements from companies and pairs them up with the elements of people. The goal is to optimize the pairings such that the sum of all pair values is maximized (the value of each individual pairing is precomputed and stored in the dictionary ctrPairs).
They're all paired in a 1:1, each company has...
I am trying to calculate an initial buffer size to use when decompressing data of an unknown size. I have a bunch of data points from existing compression streams but don't know the best way to analyze them.
Data points are the compressed size and the ratio to uncompressed size.
For example:
100425 (compressed size) x 1.3413 (compressi...
I have an array of 200 items. I would like to output the array but group the items with a common value. Similar to SQL's GROUP BY method. This should be relatively easy to do but I also need a count for the group items.
Does anyone have an efficient way of doing this? This will happen on every page load so I need it to be fast and scala...
Hi,
I am implementing Voronoi diagram to find out the nearest location in a map visually. Right now I want to do this using integer coordinates (x,y) only in a canvas.
Problem is- I am really confused about this algorithm. I read the Computational Geometry book, few more theory on Fortune's algorithm. And I am really confused now. It se...
Given a scenario where we have multiple lists of pairs of items, for example:
{12,13,14,23,24}
{14,15,25}
{16,17,25,26,36}
where 12 is a pair of items '1' and '2' (and thus 21 is equivalent to 12), we want to count the number of ways that we can choose pairs of items from each of the lists such that no single item is repeated. You mu...
i have two color "red" also "Salmon". i need create dynamiclly panel also panel background color. These colors must be between two color(red
public Color x, y;
protected void Page_Load(object sender, EventArgs e)
{
BackGroundColorArranger(Color.Red, Color.Salmon);
}
void BackGroundColorArrang...
I was watching one of those incredibly retarded tv quiz money scams last night as I was reading reddit and they posed the question:
if you wrote down all the numbers between 32 to 287 how may times would you write down the number 6?
So I did some quick maths in my head (there are 11 sixes in each 100, there are two hundreds in betw...
Suppose given an array of size n, with sorted values.
In iteration i, a new random-generated value is given, and inserted into the end of the array.
The array is then resorted, and discard the least value item.
After iteration n, the retained array will contain the largest value items.
For example, in Java syntax, it will be somet...
How can i generate 16 color. my starter color is "Red" and my terminal color "khaki". i have to insert 14 color. But it looks like gradient flow. Forexample color.Black does not come from red. Violent should come red from red.
...
H community,
I wanted to ask if there is an algorithm for choosing the optimal amount of support points for creating a bezier spline in order to make it look smooth and reduce the error. If there is such an algorithm how fast is the algorithm?
Thanks in advance
Sebastian
...
I'm trying to build a utility like this http://labs.ideeinc.com/multicolr,
but I don't know which algorithm they are using, Does anyone know?
...
I need to be able to calculate (a^b) % c for very large values of a and b (which individually are pushing limit and which cause overflow errors when you try to calculate a^b). For small enough numbers, using the identity (a^b)%c = (a%c)^b%c works, but if c is too large this doesn't really help. I wrote a loop to do the mod operation manu...
I am kind of hitting a wall on this problem and I was wondering if some fresh brains could help me out.
I have a large list of four element tuples in the format:
(ID number, Type, Start Index, End Index)
Previously in the code, I have searched through thousands of blocks of text for two specific types of substrings. These tuples stor...
I have a database of 20 million users and connections between those people. How can I prove the concept of "Six degrees of separation" concept in the most efficient way in programming?
link to the article about Six degrees of separation
...
Assume the database has tables for Users, Feeds, Items, and an ability to know which Items the user has already seen. I am looking for a design paradigm that can be used on the server to compute in a short amount of time [feed id, num_unread] for each feed that the user has subscribed to.
Assume plenty of users and that the feeds are g...
I have an existing (java) application that models an order book, as it stands each order is visible to every other. There is now a requirement to put (what is effectively) a per order ACL in place.
An example to illustrate, lets say I have access groups [V-Z] and orders [A-F]
A B C D E F
V 1 0 0 1 1 0
W 0 1 1 0 0 1
X ...
I have a table which indexes the locations of words in a bunch of documents.
I want to identify the most common bigrams in the set.
How would you do this in MSSQL 2008?
the table has the following structure:
LocationID -> DocID -> WordID -> Location
I have thought about trying to do some kind of complicated join... and i'm just doing...
Hello!
How to calculate the entropy of a file? (Or let's just say a bunch of bytes)
I have an idea, but I'm not sure that it's mathematically correct.
My idea is the following:
Create an array of 256 integers (all zeros).
Traverse through the file and for each of its bytes,
increment the corresponding position in the array.
At the en...
I have got a 3D grid (voxels), where some of the voxels are filled, and some are not. The 3D grid is sparsely filled, so I have got a set filledVoxels with coordinates (x, y, z) of the filled voxels. What I am trying to do is find out is for each filled voxel, how many neighboring voxels are filled too.
Here is an example:
filledVoxel...
What would be a simplest algorithm one or more people could use to decide who of them should perform some task? There is one task, which needs to be done only once, and one or more people. People can speak, that is, send messages one to another. Communication must be minimal, and all people use the exact same algorithm.
One person sayin...