Lets say I have a integer result and an array of integers, lets say [a,b,c] (not a fixed length). I need to detect if result=a*i +b*j + c*k, with i,j,k>=0.
I prefer a solution in C/C# if it is possible.
PS The problem is from a reservation system, a trip can be sold if its durations is a combination of given durations.
Thanks!
Ex:...
I am writing my Bachelor thesis about a Dynamic Carpooling service. It uses air-to-air distances, as I could not find resources to have a system using maps and routings.
I am interested to know if there already exists an algorithm that does the same as mine.
I know that my algorithm is very simple. I just would like to know if I have re...
I have 2 (or more) intersecting meshes, which require joining into 1 mesh object. I want to have some control over the resulting seam vertex insertion, so looking to write myself rather than use a library.
Has anyone come across some open source code to base the algorithm on / ideas on the process? Initial impressions are:
1. Present in...
A triangular number is the sum of the n natural numbers from 1 to n. What is the fastest method to find whether a given positive integer number is a triangular one?
...
Let me describe the system. There are several mobile devices, each independent from each other, and they are generating content for the same record id.
I want to avoid generating the same content for the same record on different devices, for this I though I would use a random and make it so too cluster the content pool based on these ran...
i need create function which returns d th bit of given number
can anybody help me?
...
Hi, I want to implement the Binary Quicksort algorithm from [Robert Sedgewick's book][1]. It looks like this:
public class quickb{
public static final int bitsword=32;
public static void quicksortB(int a[],int l,int r,int d){
int i=l;
int j=r;
if (r<=l || d>bitsword) return ;
while (j!=i)
{
while (digit(a[i],d)==0 && (i<j)) ...
Hey folks,
I have been looking all over the Web for a way to plot an ellipse from rectangle coordinates, that is, top-left corner (x, y) and size (width and height). The only ones I can find everywhere are based on the Midpoint/Bresenham algorithm and I can't use that because when working with integer pixels, I lose precisions because t...
def maxVote(nLabels):
count = {}
maxList = []
maxCount = 0
for nLabel in nLabels:
if nLabel in count:
count[nLabel] += 1
else:
count[nLabel] = 1
#Check if the count is max
if count[nLabel] > maxCount:
maxCount = count[nLabel]
maxList = [nLabel,]
...
I need an algorithm that allows me to determine an appropriate <priority> field for my website's sitemap based on the page's views and comments count.
For those of you unfamiliar with sitemaps, the priority field is used to signal the importance of a page relative to the others on the same website. It must be a decimal number between 0 ...
What are all the algorithms involved in Farmville game, specifically I am interested in drawing trees that has fruits based on user's activities.
I am into a project which has a specific need to draw a tree-type image in SVG. I am not sure how to go about the algorithms to define the tree and based on certain business rules the leafs in...
suppose that we have three array
int a[]=new int[]{4,6,8,9,11,12};
int b[]=new int[]{3,5,7,13,14};
int c[]=new int[]{1,2,15,16,17};
and we want to merge it into one big d array where d.length=a.length+b.length+c.length
but we have memory problem it means that we must need use only this d array where we should merge these th...
Hello! For example I have collection of blocks
Input:
[
[name: "Block #1", x:0, y:0, width:4, height:1],
[name: "Block #2", x:0, y:1, width:2, height:1],
[name: "Block #3", x:2, y:2, width:2, height:1]
]
Output:
<table width="4" border="1">
<tr>
<td colspan="2" width="4" height="1">Block #1</td>
</tr>
<tr> ...
For example I have array:
int a[] = new int[]{3,4,6,2,1};
I need list of all permutations such tha if one is like this, {3,2,1,4,6}, others must not be the same. I know that if the length of the array is n then there are n! possible combinations. How can this algortihm be written?
Update: thanks, but I need a pseudo code algorithm l...
I have posted a similar problem in Permutation of array, but I want the following.
We know that with length n there are n! possible permutations from which one such that all element are in order. They are in sorted variant so I want break permutation when the array is ordered and print result, but something is wrong. I think that probl...
Can someone point me to some resources or papers on the LZINT compression algorithm?
I Google'd it and only found a handful of link that were in Chinese or Russian. After I Google translated, they were just briefly mentioning it.
Is the algorithm even open source? If not, does anyone know the company that licenses it?
...
Hi,
perhaps anyone knows if this is possible.
comparing image quality is almost imposible to describe without subjective influences. When someone rates an image quality as good there is at least one person, that doesn't think so.
human preferences are always different.
So, I would like to know if there is away to "rate" the image quali...
Is there any fast method to make a transposition of a rectangular 2D matrix in Python (non-involving any library import).? Say, if I have an array X=[[1,2,3], [4,5,6]] I need an array Y which should be a transposed version of X, so Y=[[1,4],[2,5],[3,6]].
...
I want to implement the quicksort 3 way partition. Here is the code:
public class quick3 {
public static void quicksort3(int a[],int l,int r) {
int k;
int v = a[r];
if (r<=l)
return;
int i = l;
int j = r;
int p = l-1;
int q = r;
for (;;) {
w...
Hi everyone,
I'm trying to write a simple tracking routine to track some points on a movie.
Essentially I have a series of 100-frames-long movies, showing some bright spots on dark background.
I have ~100-150 spots per frame, and they move over the course of the movie. I would like to track them, so I'm looking for some efficient (but ...