I need a CRC mechanism to calculate the CRC of a number of strings, such that, given two strings, A and B, the sum crc(A) + crc(B) == crc(A+B).
P.S. XOR is too weak---the algorithm should be not trivial for reverse engineering.
...
Hello,
A part of a process requires to apply String Similarity Algorithms.
The results of this process will be stored and produce lets say SS_Dataset.
Based on this Dataset, further decisions will have to be made.
My questions are:
Should i apply one or more string similarity algorithms to produce SS_Dataset ?
Any comparisons...
I would like to compute both the sine and co-sine of a value together (for example to create a rotation matrix). Of course I could compute them separately one after another like a = cos(x); b = sin(x);, but I wonder if there is a faster way when needing both values.
Edit:
To summarize the answers so far:
Vlad said, that there is the a...
I want to calculate the amount to charge my customers, when they buy licenses of my product.
I sell it in ranges of licenses:
1-10 : $50/user
11-20 : $40/user
21-30 : $30/user
31-50 : $20/user
So when someone purchases 136 licenses, I will charge him:
50 x 2 x $20 = $2000
30 x 1 x $30 = $900
6 x $50 = $300
I'm looking for an...
Hi,
I'm trying to extract the minimum from a binary heap but it's not working. Here's my BubbleDown code:
void heapBubbleDown(Heap * const heap, int idx) {
int min;
while(RIGHT(idx) < heap->count) {
min = LEFT(idx);
if(RIGHT(idx) < heap->count) {
if(heap->items[LEFT(idx)] > heap->items[RIGHT(idx)])...
I have a datastructure with a field of the float-type. A collection of these structures needs to be sorted by the value of the float. Is there a radix-sort implementation for this.
If there isn't, is there a fast way to access the exponent, the sign and the mantissa.
Because if you sort the floats first on mantissa, exponent, and on exp...
Hi,
I'm looking for an algorithm to calculate total cost of licenses purchased based on the "FogBugz for your server" pricing scheme (http://www.fogcreek.com/FogBugz/PriceList.html).
Fogbugz pricing is:
1 License $299
5 License Pack $999
10 License Pack $1,899
20 License Pack $3,499
50 License Pack $7,999
If you ask a quo...
Is it possible to create collision free hash function for a data structure with specific properties.
The datastructure is int[][][]
It contains no duplicates
The range of integers that are contained in it is defined. Let's say it's 0..1000, the maximal integer is definitely not greater than 10000.
Big problem is that this hash functi...
I'm searching for an algorithm for Digit summing. Let me outline the basic principle:
Say you have a number: 18268.
1 + 8 + 2 + 6 + 8 = 25
2 + 5 = 7
And 7 is our final number. It's basically adding each number of the whole number until we get down to a single (also known as a 'core') digit. It's often used by numerologists.
I'm sea...
I need to output to HTML a list of categorized links in exactly three columns of text. They must be displayed similar to columns in a newspaper or magazine. So, for example, if there are 20 lines total the first and second columns would contain 7 lines and the last column would contain 6. The list must be dynamic; it will be regularly ch...
I'm sure this is fairly simple, however I have a major mental block on it, so I need a little help here!
I have an array of 5 integers, the array is already filled with some data. I want to set the last N bits of the array to be random noise.
[int][int][int][int][int]
eg. set last 40 bits
[unchanged][unchanged][unchanged][24 bits of ...
I want to draw some items on screen, each item is in one of N sets. The number of sets changes all the time, so I need to calculate N different colours which are as different as possible (to make it easy to identify what is in which set).
So, for example with N = 2 my results would be black and white. With three I guess I would get all ...
Assume that we have a sequence S with n elements <x1,x2,...,xn>. A pair of elements xi,xj are considered neighbors if |xi-xj|<d, with d a given distance between two neighbors. So how can find out the element that has most neighbors in the sequence?
(A simple way is sorting the sequence and then calculating number of each element but it'...
Dynamic programming is, almost by definition, to find a shortest/longest path on an implicit dag.
Every DP algorithm just does this.
An Holographic algorithm can be loosely described as something that counts perfect matchings in implicit planar graphs.
So, my question is: are there any other families of algorithms that use well-known a...
I want to find the first set of integers in an array X that the sum equals a given number N.
For example:
X = {5, 13, 24, 9, 3, 3}
N = 28
Solution = {13, 9, 3, 3}
Here what I have so far :
WARNING, I know it uses global and it is bad,that's not the point of the question.
<?php
function s($index = 0, $total = 0, $solution = '')
{
...
How does Trie and B+ tree compare for indexing lexicographically sorted strings [on the order some billions]?
It should support range queries as well.
From perf. as well as implementation complexity point of view.
...
Please consider following use case,
I have one bigger image, lets called is master image.
Now from some where else, I am getting one small image. I want to check whether this small image is subset of master image or not.
important points are,
smaller image might have different file format,
smaller image might captured from comparati...
Hi,
I am looking for a best allocation algorithm for the below scenario.
We have requirement for say 18 pieces. I have the stock in my shelf as follows.
Bin A - 10
Bin B - 6
Bin C - 3
Bin D - 4
Algorithm should propose the bins in the following order
Bin A(10) , Bin D (4), Bin C (3)
Real scenario we have n number of bins...
I am trying to use this logic to understand what is going on with the adjacency matrix, but i am massivley confused where it says about interspacing for a b c d .....
Could anyone explain what is going on here?
Thank you
(tagged as java as its the language this was demonstrated to us in, so if anyone posted any code examples they could...
Explain which algorithm you would use to implement a function that takes an array of integers and returns the maximum integer in the collection, assuming that the length of the array is less than 1000. Would you use Bubble Sort or Merge Sort and Why?
Also, what happens to the above algorithm choice, if the array length is greater than 1...