mohammad.dibay
BAN USER
Comments (3)
Reputation 0
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
0
of 0 vote
I think there are different ways to shuffle cards, to make sure every card is shuffled, we can go through the array, and replace array[i] with array[i+1 mode n], and change the shuffle flag to True. Or we can use Knuth's shuffle algorithm to generate a random number proportional to the size of the remained unshuffled array.
- mohammad.dibay April 04, 2013Comment hidden because of low score. Click to expand.
0
of 0 vote
public float meanvalue(int[] graph, int i)
{
float mean = 0 ;
int count = 0 ;
for all node in graph{
node.visit = false;
}
stack.push(i);
while(!stack.empty())
{
p <- stack.pop()
if(p is not visited)
{
visited[p] = true;
count++ ;
mean = mean + p.value;
for each neighbor p:
stack.push(p.neighbor)
}
}
mean = mean/ count;
return mean;
}
Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
}
- mohammad.dibay April 04, 2013