You have (up to 100) distinct sets of (2-4) numbers. The order of the sets or numbers in the sets does not matter. The highest number relates to the number of sets and goes up to 30. Like:
{1 2 3 4}
{1 2 3 5}
{1 2 3}
{1 2 4 5}
{6 2 4}
{6 7 8 9}
{6 7 9}
{7 8 9}
{2 4 8 9}
The goal is, to arrange these sets in a particular order, where tw...
I only have two variables to work with here, age (unix timestamp) and hits. I'm wondering if there is a solution in MySQL to calculate and order by the popularity of something. The algorithm would have to acknowledge that new items would not necessarily have as many hits as older ones but are more popular.
Is this possible the way I'm i...
Is there any way to round up decimal value to its nearest 0.05 value in .Net?
Ex:
7.125 -> 7.15
6.66 -> 6.7
If its now available can anyone provide me the algo?
...
Is there any specific reason for not having std::copy_if algorithm in C++ ? I know I can use std::remove_copy_if to achieve the required behavior. I think it is coming in C++0x, but a simple copy_if which takes a range, a output iterator and a functor would have been nice. Was it just simply missed out or is there some other reason behin...
Here's an example I ran across:
private function bitwiseAnd(a:int, b:int):int {
var result:int = 0;
var n:int = 1;
while ((a > 0) && (b > 0)) {
if (((a % 2) == 1) && ((b % 2) == 1)) {
result += n;
}
a = a / 2;
b = b / 2;
n = n * 2;
}
return result;
}
So basica...
I'm trying to figure out a way to algorithmically get the amplitude and phase of a function that has sinusoidal terms in the Maxima computer algebra system. This only applies to steady state (as t -> infinity and the transients decay). For example, a trivial case would be:
f(t) = 1 / w * sin(w * t + theta) + exp(-a * t) + 8
In this ...
I'm planning to write a program to sync a folder in real time across multiple computers over the internet. I'm wondering if there is any sync algorithm to handle file sync conflicts, ie, computer A tries to save a file, while computer B has removed the file.
...
Possible/partial duplicates:
What’s a good rate limiting algorithm?
Throttling method calls to M requests in N seconds
Best way to implement request throttling in ASP.NET MVC?
I am looking for the best way to implement a moving time window rate limiting algorithm for a web application to reduce spam or brute force attacks.
Examples ...
I am looking for an algorithm that, based on the previous behavior of a system, predicts the future behavior.
I'm building a parallel memory allocator that has a public list of empty blocks. Each thread, when it needs, can take blocks from this list and allocate from them. The blocks are grouped in bins, depending on the allocation si...
I am a student interested in developing a search engine that indexes pages from my country. I have been researching algorithms to use for sometime now and I have identified HITS and PageRank as the best out there. I have decided to go with PageRank since it is more stable than the HITS algorithm (or so I have read).
I have found countle...
I'm trying to better understand what exactly this code is doing. It's written in Objective-C, but should be familiar to anyone with a C background. What exactly are sin/cos mathematics doing here? Also, does anyone have a good recommendation for learning trig for gaming concepts such as these?
for (int i = 0; i < GAME_CIRCLES; i++)
{
p...
I'm looking for an algorithm (or some other technique) to read the actual content of news articles on websites and ignore anything else on the page. In a nutshell, I'm reading an RSS feed programatically from Google News. I'm interested in scraping the actual content of the underlying articles. On my first attempt I have the URLs from th...
If I have a set of values (which I'll call x), and a number of subsets of x:
What is the best way to work out all possible combinations of subsets whose union is equal to x, but none of whom intersect with each other.
An example might be:
if x is the set of the numbers 1 to 100, and I have four subsets:
a = 0-49
b = 50-100
c = 50-75...
Consider the following table:
<table>
<thead>
<tr>
<th scope="col" />
<th scope="col">A</th>
<th scope="col">B</th>
<th scope="col">C</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Apples</td>
<td>Oranges<...
Hi all
just wondering does anyone in here have good idea about generating nice order id?
for example
832-28-394, which show a quite nice and formal order id (rather than just use an database auto increment number like ID=35).
the order id need to look random so it can not be able to guess by user.
e.g. 832-28-395 (shoudnt exist) ...
How do you efficiently transpose a matrix? Are there libraries for this, or what algorithm would you use?
E.g.:
short src[W*H] = {
{1,2,3},
{4,5,6}
};
short dest[W*H];
rotate_90_clockwise(dest,src,W,H); //<-- magic in here, no need for in-place
//dest is now:
{
{4, 1},
{5, 2},
{6, 3}
};
(In my specific case its src arr...
I'm doing some work on a Complex Event Processing system. It supports filtering of sets of records based on members of those records, using a query language. The language supports logical, arithmetic and user-defined operators over arbitrary members.
Here's an example of a supported query:
( MemberA > MemberB ) &&
( @in MemberC { "str...
Looking for any information/algorithms relating to comparing vector graphics. E.g. say there two point collections or vector files with two almost identical figures. I want to determine that a first figure is about 90% similar to the second one.
...
I'm looking for an algorithm that would move a point around an arbitrary closed polygon that is not self-crossing in N time. For example, move a point smoothly around a circle in 3 seconds.
...
Does anyone know where I can find nicely organized in one placed (maybe a table, but doesn't have to) an asymptotic analysis of basic data structures. I'd like to refresh my understanding of data structures and also search and sorting algorithms.
So I'm looking for best, avg. and worst case scenarios.
It wouldn't hurt if it included STL...