I need help making an algorithm to detect that all the conditions for HAVE_ENOUGH_DATA are met (and continuously checking until they are met) and I am stumped as to how to calculate all the necessary variables using SoundManager2's whileloading option. I don't need code, just a general algorithm that would work (even pseudo-code is fine)...
Hi,
I have 2 datagridviews (say, DGV-A and DGV-B) having just one column each.
I want to find whether the item in DGV-A also exists in DGV-B. Basically, I am looking for a VLookup function available in MS-Excel.
This can be done trivially, bus iterating over the values in DGV-A and for each iteration of DGV-A, iterate over DGV-B and se...
I got this problem from an interview with Microsoft.
Given an array of random integers,
write an algorithm in C that removes
duplicated numbers and return the unique numbers in the original
array.
E.g Input: {4, 8, 4, 1, 1, 2, 9} Output: {4, 8, 1, 2, 9, ?, ?}
One caveat is that the expected algorithm should not required the...
What algorithm would be good for this?
I have a list of tickets and there is an assigned priority from 1-5, 1 being the lowest and 5 the most important. Arithmetic mean wouldn't do me any good because if a ticket of high priority cancels out a lower one. Mode wouldn't have enough sampling. Median same problem. What would you guys sugges...
Looking for method for wrapping a 2d image around a 3d object, such as a helmet, and then unwrapping it back to 2d image to allow printing. For example, you have a photograph that you want to use to wrap a bike helmet. You do not want the image to be distorted even though it will be wrapped on complex 3d object. Once sized and positioned...
I am getting an "Illegal start of expression" error in the following code at the location marked by a comment. How can I correct this error?
class planetUfo {
public static void main (String[] args) {
// having data for counting the index
char letters[] = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','...
Design an efficient algorithm to sort 5 distinct - very large - keys less than 8 comparisons in the worst case. You can't use radix sort.
...
How can I add business days to the current date in Java?
public Calendar addBusinessDate(Calendar cal, int days) {
//
// code goes over here
//
}
Note:
It should consider weekends too.
...
I'm trying to understand how the rsync algorithm works with respect to rolling checksums and blocks that match in a staggered fashion.
The wikipedia page seems to suggest that the sender and receiver both calculate and exchange rolling checksums for all possible blocks. But that would mean sending essentially one checksum per byte! I mu...
This may sound like an odd question, but where can I find a random number generator that works in C or C++ that is not very good?
Context: I'm creating some tree graph plotting software and testing it by using multi-digit random numbers (so each digit becomes a node in the tree). The random number generator I've been using - which is th...
I have a digraph which is strongly connected (i.e. there is a path from i to j and j to i for each pair of nodes (i, j) in the graph G). I wish to find a strongly connected graph out of this graph such that the sum of all edges is the least.
To put it differently, I need to get rid of edges in such a way that after removing them, the g...
How to calculate number of sequences over {0,1} such that each sequence contains at least half ones?
...
.NET framework has got a Dictionary<TKey,TValue> class which is implemented as hash tables and provides data retrieval in constant time (O(1)). I am looking for a similar implementation in C++. I know about std::map but in this data retrieval takes logarithmic time. Is there any good hash table implementation in C++ which will retrieve d...
Hello! I Wonder if someone has used Markov Algorithm-based programming system or embedded facility in production or for scientific purpose.
I know about 'REFAL' programming language invented a thousand years ago, but it all seems to be dead, so..
Ref: http://en.wikipedia.org/wiki/Markov_algorithm
...
Genetic algorithms (GA) and genetic programming (GP) are interesting areas of research.
I'd like to know about specific problems you - the SO reader - have solved using GA/GP and what libraries/frameworks you used if you didn't roll your own.
Questions:
What problems have you used GA/GP to solve?
What libraries/frameworks did you us...
Hi everybody. I'm looking for a .NET-Class library or .NET-Framework which implements ant colony optimization. Can you give me any links, resources, etc. about this topic.
...
Imagine, there are two same-sized sets of numbers.
Is it possible, and how, to create a function an algorithm or a subroutine which exactly maps input items to output items? Like:
Input = 1, 2, 3, 4
Output = 2, 3, 4, 5
and the function would be:
f(x): return x + 1
And by "function" I mean something slightly more comlex than [1]:
...
I'm doing some tests clustering a big number of very large sparse vectors representing term-frequency-inverse-document-frequency of various hypertextual documents. What algorithm would you suggest for clustering this data, taking into account the proportions of the data set? The dimension of the vectors would be > 3·105 and the number of...
I'd like to spruce up some of the user controls I use and thought some attractive fills should do the job (part of it perhaps). Like the fill in the background of iPhone buttons or the Office 2007 ribbon bar (perhaps you know a few more).
Edit:
To clear things up, I don't need a simple gradient fill - there is a Windows API call for tha...
I am trying to complete the first exercise of USACO.
How can you make the following code more efficient?
It seems that the current problem in the program is that its execution takes too much time.
Thank you for suggesting the first four sets of improvements!
I made a few edits based on your comments.
5th edition of the code
/*
...