I would like to write a fuzzy date method for calculating dates in Objective-C for iPhone. There is a popular explanation here:
http://stackoverflow.com/questions/11/how-do-i-calculate-relative-time
However it contains missing arguments. How could this be used in Objective-C?. Thanks.
const int SECOND = 1;
const int MINUTE = 60 * SEC...
I'm trying to figure out what is the best practice while designing parallel algorithm for model of data distribution. What could be pros and cons against block distribution vs cyclic distribution of data in memory. Any help would be appreciated.
...
Is it possible to speed up this snippet?
firstSample and lastSample is the part of the array I'm interested in this iteration. It's when this interval reaches > 3000 that I get a noticeable slowdown. The _average array can contain 6-60 million int values.
minY and maxY is the result I use after this calculation is completed.
int min...
Is it possible to convert code into a logical graph?
EDIT:
What I am thinking is that math is absolute. We can judge whether it is right or wrong for sure. But for code, there is something other than the logic. What I want to do is remove that 'something' to keep the logic there only.
...
Hello,
I have a large number of sets of numbers. Each set contains 10 numbers and I need to remove all sets that have 5 or more number (unordered) matches with any other set.
For example:
set 1: {12,14,222,998,1,89,43,22,7654,23}
set 2: {44,23,64,76,987,3,2345,443,431,88}
set 3: {998,22,7654,345,112,32,89,9842,31,23}
Given the 3 set...
I am not completely sure about the following table
The table provides the size of problem that can be solved in the time limit given in the left-hand column when the algorithmic complexity is of the given size.
I am interested in the deduction of the table.
The table suggests me that
O(n) = 10M in a second (This seems to be the p...
I just read how team BellKor’s Pragmatic Chaos is winning the Netflix Challenge on Wired, and I'm curious about how this kind of algorithms usually work. I know team Bellkor's solution must be an innovative one on the field.. but how does the field usually work? Is it just a really detailed database with Markov chains being run over agai...
I started reading Intro to Algorithms by Cormen et al like 3 weeks ago on my free time. I finished the second chapter and have been trying out the exercises for quite a while. I find them a bit difficult.
Is this normal? Should I finish all the exercises before moving on? Or is it alright if I solve the ones I can and move on to the ne...
Hi,
I'm trying to programm a k-means algorithm in Java. I have calculated a number of arrays, each of them containing a number of coeficients. I need to use a k-means algorithm in order to group all this data. Do you know any implementation of this algorithm?
Thanks
...
Most battle-tested, real-world software contains extensive error checking and logging. We frequently employ complex logging systems to help diagnose, and occasionally predict, failures before they happen. We generally focus on reporting the catastrophic failures on the server-side.
These failures are important of course, but I think th...
I've written a game of tic-tac-toe in Java, and my current method of determining the end of the game accounts for the following possible scenarios for the game being over:
The board is full, and no winner has yet been declared: Game is a draw.
Cross has won.
Circle has won.
Unfortunately, to do so, it reads through a predefined set o...
I just found out murmur hash, seems to be the fastest known and quite collision resistance. I tried to dig more about the algorithm or implementation in full source code, but I am having difficulty understanding it. Could someone here explain the algorithm used, or implement it in full source code, preferably in C. I read the C source co...
This question is about a data structure I thought of. It is a dynamic array, like std::vector<> in C++, except the removal algorithm is different.
In a normal dynamic array, when an element is removed, all the remaining elements must be shifted down, which is O(n), unless it's the last element, which will be O(1).
In this one, if any e...
Greetings,
With javascript, I am trying to make a very easy animation, an image moves from one X and Y coordination to another X Y coordination.
I have 4 constant such as:
var startX = 0; //starting X of an image
var startY = 0; //starting Y of an image
var endX = 100; //ending X of an image
var endY = 200; //ending Y of an image
//the...
Is there an algorithm to estimate the median, mode, skewness, and/or kurtosis of set of values, but that does NOT require storing all the values in memory at once?
I'd like to calculate the basic statistics:
mean: arithmetic average
variance: average of squared deviations from the mean
standard deviation: square root of the varianc...
I'm looking for a good address-parser that could parser any free texts and generate a tokenized output:
If you have something in C# would be helpful, but has no problem if in another language.
Example 1:
Free text entry: 23 Street n. 213 new york ny
Output: Street: 23 Street, Number: 213, City: New York, State: NY
Example 2:
Fr...
This question relates to those parts of the KenKen Latin Square puzzles which ask you to find all possible combinations of ncells numbers with values x such that 1 <= x <= maxval and x(1) + ... + x(ncells) = targetsum. Having tested several of the more promising answers, I'm going to award the answer-prize to Lennart Regebro, because:
...
Hi I was wondering if there is any known way to get rid of unnecessary parentheses in mathematical formula. The reason I am asking this question is that I have to minimize such formula length
if((-if(([V].[6432])=0;0;(([V].[6432])-([V].[6445]))*(((([V].[6443]))/1000*([V].[6448])
+(([V].[6443]))*([V].[6449])+([V].[6450]))*(1-([V].[6446])...
I'm wondering what kind(s) of data structures / algorithms might help facilitate handling the following situation; I'm not sure if I need a single FIFO, or a priority queue, or multiple FIFOs.
I have N objects that must proceed through a predefined workflow. Each object must complete step 1, then step 2, then step 3, then step 4, etc. E...
I need to calculate the edit distance between trees for a personal project of mine. This paper describes an algorithm, but I can't make heads or tails out of it. Are you aware of any resources that describe an applicable algorithm in a more approachable way? Pseudocode or code would be helpful, too.
...