I've recently read an interesting thread on the D newsgroup, which basically asks,
Given two (signed) integers a [amin, amax], b [bmin, bmax], what is the tightest interval of a | b?
I'm think if interval arithmetics can be applied on general bitwise operators (assuming infinite bits). The bitwise-NOT and shifts are trivial sin...
I want to find out all the existing decentralized algorithms that exploit the structural properties of social networks. So far I know the following algorithms -
1) Best connected search - Adamic et al
2) Random Walk (does not exploit any structural property but still it is decentralized)
3) Hamming distance search
4) Weak/Strong tie...
#include<stdio.h>
main()
{
long long int m,n,i,j;
int t;
scanf("%d",&t);
while(t--)
{
scanf("%lld",&m);
scanf("%lld",&n);
long long int a[n+2];
for(i=0;i<=n;i++)
{
a[i]=1;
}
for(i=2;i<=sqrt(n);i++)
{
j=2;
while((i*j)<=n)
...
Okay so i need really FAST algorithm or code in C if you have any it would be nice. The task is to sum all numbers from 1 to N for a given number N (it can be negative number too), so i did the usual way (you know just summing with loop from 1 to N) but it's not fast enough - i need something faster, i guess that i need the fastest possi...
Hello,
Knowing that we can use Divide-and-Conquer algorithm to compute large exponents, for exemple 2 exp 100 = 2 exp(50) * 2 exp(50), which is quite more efficient, is this method efficient using roots ? For exemple 2 exp (1/100) = (2 exp(1/50)) exp(1/50) ?
In other words, I'm wondering if (n exp(1/x)) is more efficient to (n exp(1/y)...
I have a 2 dimensional array forming a table:
[color][number][shape ]
-------------------------
[black][10 ][square ]
[black][10 ][circle ]
[red ][05 ][triangle]
[red ][04 ][triangle]
[green][11 ][oval ]
and what I want to do is group largest common denominators, such that we get:
3 groups
group #1: color=bl...
I'm seeking to display a fixed number of items on a web page according to their respective weight (represented by an Integer). The List where these items are found can be of virtually any size.
The first solution that comes to mind is to do a Collections.sort() and to get the items one by one by going through the List. Is there a more e...
Hi I am am trying to complete an assignment, where it is ok to consult the online community. I have to create a graph class that ultimately can do Breadth First Search and Depth First Search. I have been able to implement those algorithms successfully however another requirement is to be able to get the successors and predecessors and ...
Possible Duplicate:
Estimating/forecasting download completion time
Just curious how does ftp clients calculate estimated time to finish? Does it use any average number over past few minutes' data or any other algorithm to get more accurate time? Thanks.
...
I know there are quite a bunch of questions about big O notation, I have already checked Plain english explanation of Big O , Big O, how do you calculate/approximate it?, and Big O Notation Homework--Code Fragment Algorithm Analysis?, to name a few.
I know by "intuition" how to calculate it for n, n^2, n! and so, however I am completely...
Hey,
I want to draw the call stack for any recursive method, so I've created a schema like this,
recursiveMethod(){
//Break recursion condition
if(){
// Add value here to the return values' list- No drawing
return
}
else{
//Draw stack with the value which will be pushed to the stack here
variable <- recursive...
Hi you all,
I'm trying to do this contest exercise about graphs:
XPTO is an intrepid adventurer (a little too temerarious for his own good) who boasts about exploring every corner of the universe, no matter how inhospitable. In fact, he doesn't visit the planets where people can easily live in, he prefers those where only a madman woul...
There's about 2 months left in Al Zimmermann's Son of Darts programming contest, and I'd like to improve my standing (currently in the 60s) to something more respectable. I'd like to get some ideas from the great community of stackoverflow on how best to approach this problem.
The contest problem is known as the Global Postage Stamp Pro...
Hi there,
I've got a bunch of products with sizes to ship and I need to find out the cheapest rate.
Given a shipment made out of sizes, say [1,3,3,5] I need to decide how to ship - all together or separate. However it's not as simple as [1,3,3,5] or 1 & 3 & 3 & 5, i need all of the possible combinations something like:
[
[[1,3,3,5]], ...
If I insert the letters A, G, I, and Y into a B-tree of order 4 (meaning 4 pointers and 3 elements in each node), I get the following B-tree.
G
/ \
A IY
Would it look any different if redistribution on insertion were used? How does redistribution on insertion work?
...
I have N rectangles with sides parallel to the x- and y-axes. There is another rectangle, model. I need to create an algorithm that can tell whether the model is completely covered by the N rectangles.
I have some ideas. I think that first, I need to sort the rectangles by their left side (it can be done in O(n log n) time), and then...
How can I take an input word (or sequence of letters) and output a word from a dictionary that contains exactly those letters?
Does java has an English dictionary class (list of words) that I can use, or are there open source implementations of this?
How can I optimize my code if this needs to be done repeatedly?
...
Is there any tricky way to implement a set data structure (a collection of unique values) in C? All elements in a set will be of the same type and there is a huge RAM memory.
As I know, for integers it can be done really fast'N'easy using value-indexed arrays. But I'd like to have a very general Set data type. And it would be nice if a...
Let's say I have a set of integers. I want to find the longest increasing subsequence of that set using dynamic programming. This is simply out of practice, reviewing my old notes from my algorithms course, and I don't seem to understand how this works.
Thanks
...
For any three given sets A, B and C: is there a way to determine (programmatically) whether there is an element of A that is part of the conjunction (edit: intersection) of B and C?
example:
A: all numbers greater than 3
B: all numbers lesser than 7
C: all numbers that equal 5
In this case there is an element in set A, being the numb...