The idea was not to go through a cycle every time.
For example i you start from A2 and the cycle is A2, A3,
When you go back to A2 do not traverse the same cycle from A3 but
proceed searching unprocessed elements.
This will work if the content of the cells is something similar to {int
A1, A2, A3, An B1, B2, ... Bn
The size of the array is 2n.
An Ai stays on a position 2*i -1.
An Bj stays on a position 2*j.
The idea is to take a content of array's cell and put it in the place
where it should stay, then you take the cell in which you put a content
calculate its deserved
Hi all,
I have this task to solve:
Given a weighted directed Graph G(V,E) with weights w(u,v). u, v -
elements of V.
If v(i, j) is element of V then v(j,i) is not.
For each vi Element of V are defined:
Sum of weights of incoming edges: Income(i)
Sum of weights of outgoing
V1 = VBadPayers
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
Hi, here is the solution.
1. Create a hashtable .
2. Go through the numbers inserting each into the hashtable. When
insert the number check if it already exists, if so - this is the
repeating number.
The complexity: O(k*n) = O(n)
--~--~-~--~~~---~--~~
You
1. Go to the end of the file.
2. Make a stack.
3. Read a block from the end - put them into a chararray[].
4. Split the charray by \n into strings[]
5. going through the strings[] backwards - put each string into the
stack.
6. repeat 3-5 until stack.size=n
7. empty the stack
Hi,
Lately I saw an interesting game and wonder is there a good algorithem
to find the best solition.
You have 5 type of bubbles in a matrix. You can select 2 or more
neighboring bubbles with the same color and remove them. The bubbles
are neighboring if they have common border.(no diagonals)
If
Hi L7,
so what is m - it is a constant isnt't it.
So O(k*n) = O(n)
which is different from O( n log n) .
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
L7,
from the first array make a hash table H- O(n)
go through the second array and test if the element is present in H1
-O(n)
so the solution is 2*O(n)=O(n)
Your solution:
sort the first array - O(n log n)
sort the second array - O( n log n)
compare the two arrays - O(n)
the solution :
It seems working for me if you use arrays. It will not work if you use
LinkedList for A.
In the case of LinkedList for A the find_min will work in O(n) time.
Regards
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
So where is the count?
And how it improves the time?
Regards
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe
Hi All,
may someone advise me for an algorithm for validateing and evaluating a
function like this:
finction(par1, par2, par3){
if(par15 and ...){
par2=par2*1.1;
}
else{
.
}
}
the function will contaim only if else
Correct.
So interesting algorithem I would say.
Where did you find it
S + X - Y = 10*(10+1) / 2 (1)
minus Y
I don't know what is the TSP's problem to solve but if it's a shortest
path between 2 points solution is:
Make a graph with the posible path between every 2 points and
kilometers between them.
Traverse the graph finding the shortest path by traversing the graph in
width.
If this is the problem I
HalFas I am interested give some more info about this point based
algorithem
16 matches
Mail list logo