[algogeeks] Re: dearrangement

2006-10-14 Thread ridvansg
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

[algogeeks] Re: dearrangement

2006-10-11 Thread ridvansg
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

[algogeeks] Find all paths from every member of set of vertices(V1) to every member of other set of vertices(V2) V1 ^ V2 = 0

2006-08-20 Thread ridvansg
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

[algogeeks] Re: Find all paths from every member of set of vertices(V1) to every member of other set of vertices(V2) V1 ^ V2 = 0

2006-08-20 Thread ridvansg
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]

[algogeeks] Re: Try this ..

2006-08-15 Thread ridvansg
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

[algogeeks] Re: Given a file (can be a huge file) ....

2006-08-10 Thread ridvansg
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

[algogeeks] Bubble breaker

2006-08-04 Thread ridvansg
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

[algogeeks] Re: Which is the fastest solution for comparing two arrays?

2006-07-20 Thread ridvansg
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

[algogeeks] Re: Which is the fastest solution for comparing two arrays?

2006-07-19 Thread ridvansg
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 :

[algogeeks] Re: DataStructure - Push,Pop Find_Min in O(1)

2006-03-25 Thread ridvansg
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

[algogeeks] Re: tree lock problem

2006-03-25 Thread ridvansg
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

[algogeeks] Evaluate an expresion

2006-01-05 Thread ridvansg
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

[algogeeks] Re: Finding Repeated and Missing Numbers

2005-12-22 Thread ridvansg
Correct. So interesting algorithem I would say. Where did you find it

[algogeeks] Re: Finding Repeated and Missing Numbers

2005-12-21 Thread ridvansg
S + X - Y = 10*(10+1) / 2 (1) minus Y

[algogeeks] Re: TSP JAVA code Needed

2005-12-15 Thread ridvansg
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

[algogeeks] Re: TSP JAVA code Needed

2005-12-15 Thread ridvansg
HalFas I am interested give some more info about this point based algorithem