Hi,
Lets say I have a non-square image..
If I increment the width and I recalculate the height according to the incremented width (ratio), sometimes I get xxx.5 (decimals) for the width
ex.: width = 4, height = 2
I augment the width with a factor of 1.25 I'll get : width = 5
Next, the height will be : heigth = 2.5
How can I determine...
Is there an algorithm to securely split a message into x parts requiring at least y parts to reassemble? Obviously, y <= x.
An example:
Say that I have a secret message that I only want to be read in the event of my death. As a way to ensure this, I give a fraction of the message to ten friends. Now, I can't guaranty that all my fri...
Given N points in a 3D space, how to find the smallest sphere that contains these N points?
...
All of the concurrent programs I've seen or heard details of (admittedly a small set) at some point use hardware synchronization features, generally some form of compare-and-swap. The question is: any there any concurrent programs in the wild where the thread interact throughout there life get away without any synchronization?
Example o...
I am working on an algorithm, and I need to be able to pass in a List and see if there are four numbers in a row at any point in the list.
I have been struggling with an easy way to do this... Here is the basic idea.. I would like the fourNumbersInARow() method to return true:
import java.util.ArrayList;
import java.util.List;
import j...
I have a case where I need to select a random item, but I don't know the total number of items and I don't want to build a huge array then pick an item out. For example, this is what I have right now:
List<string> items;
while (true)
{
string item = GetNextItem();
if (item == null)
break;
}
int index = random.GetNext(0, ...
Folks,
I have a problem. I am a writing a script in python which consists of several modules. Some of the modules are dependent on other modules, hence they should be run only after the dependent modules are successfully run. So each modules derives from a base class module and overrides a list called DEPENDENCIES which is a list of depe...
I have a bitmap and would like to return an iterator of positions of set bits. Right now I just walk the whole bitmap and if bit is set, then I provide next position. I believe this could be done more effectively: for example build statically array for each combination of bits in single byte and return vector of positions. This can't be ...
I know about hashing algorithm and hashCode() to convert "key" into an equivalent integer (using some mathematically random expression) that is then compressed and stored into buckets.
But can someone point me to an implementation or at least data structure that should be used as baseline?
I haven't found it anywhere on the web.
...
I need to choose a compression algorithm to compress some data. I don't know the type of data I'll be compressing in advance (think of it as kinda like the WinRAR program).
I've heard of the following algorithms but I don't know which one I should use. Can anyone post a short list of pros and cons? For my application the first priority ...
I am creating a graphing calculator in Java as a project for my programming class. There are two main components to this calculator: the graph itself, which draws the line(s), and the equation evaluator, which takes in an equation as a String and... well, evaluates it.
To create the line, I create a Path2D.Double instance, and loop thro...
Today I read that there is a software called WinCalibra (scroll a bit down) which can take a text file with properties as input.
This program can then optimize the input properties based on the output values of your algorithm. See this paper or the user documentation for more information (see link above; sadly doc is a zipped exe).
Do ...
Hi, I'm new in ASP development.
This is my source code :
ident = request.Form("ident")
pass=request.Form("passe")
response.write(ident)
response.write(pass)
if pass= "m" and ident="m" Then
Session("connect")="membre"
response.redirect("../")
else if pass= "g" and ident="g" Then
Session("connect")="gest"
respo...
Here is what I'm trying to do:
- i need a function that when passed as an argument an ID (for a category of things) will provide all the subcategories and the sub-sub categories and sub-sub-sub..etc.
- i was thinking to use a recursive function since i don't know the number of subcategories their sub-subcategories and so on
so here is w...
I am working on a project using Groovy, and I would like to take an array of employees, so that no manager follows their subordinates in the array. The reason being that I need to add people to a database and I would prefer not to do it in two passes.
So, I basically have:
<employees>
<employee>
<employeeid>12</employeeid>
...
To solve some problem I need to compute a variant of the pascal's triangle which is defined like this:
f(1,1) = 1,
f(n,k) = f(n-1,k-1) + f(n-1,k) + 1 for 1 <= k < n,
f(n,0) = 0,
f(n,n) = 2*f(n-1,n-1) + 1.
For n given I want to efficiently get the n-th line (f(n,1) .. f(n,n)). One further restriction: f(n,k) should be -1 if it would...
Given two sorted arrays: A and B. The size of array A is La and the size of array B is Lb. How to find the intersection of A and B?
If La is much bigger than Lb, then will there be any difference for the intersection finding algorithm?
...
http://stackoverflow.com/questions/2293762/problem-with-arithmetic-using-logarithms-to-avoid-numerical-underflow-take-2
Having seen the above and having seen softmax normalization I was trying to normalize a vector while avoiding overflow -
that is if I have an array
x[1], x[2] x[3], x[4], ... , x[n]
the normalized form for me has th...
Dear all:
I was interested to know about parameters other than space and time during analysing the effectiveness of an algorithms. For example, we can focus on the effective trap function while developing encryption algorithms. What other things can you think of ?
...
[Description] Given two integer arrays with the same length. Design an algorithm which can judge whether they're the same. The definition of "same" is that, if these two arrays were in sorted order, the elements in corresponding position should be the same.
[Example]
<1 2 3 4> = <3 1 2 4>
<1 2 3 4> != <3 4 1 1>
[Limitation] The algo...