ignore this msg. didnt read prob carefully :(On 4/3/06, Arun <[EMAIL PROTECTED]> wrote:
since A and B is sorted, we can do the merger step( in merge sort) in the reverse direction from end.the merger step in merge sort is linear.
On 4/3/06,
Padmanabhan Natarajan <[EMAIL PROTECTED]> wrote:
This so
since A and B is sorted, we can do the merger step( in merge sort) in the reverse direction from end.the merger step in merge sort is linear.On 4/3/06,
Padmanabhan Natarajan <[EMAIL PROTECTED]> wrote:
This solution looks correct but its still not clear as to how it is linear.A totally different pe
Known array: a[max]; divide a[] into four sections: a[0] - a[x], a[x+1]
- a[y], a[y+1] - a[z], a[z+1] - a[max-1].
And 0http://groups.google.com/group/algogeeks
-~--~~~~--~~--~--~---
This solution looks correct but its still not clear as to how it is linear.A totally different perspective, can we think of this as a set of points in a plane. Maybe a geometric view of the problem can throw some light.
On 4/3/06, Arunachalam <[EMAIL PROTECTED]> wrote:
Here is the improvement to my
if(curr == NULL) return 0;if(curr->left == NULL && curr->right == NULL) return 0;return 1 + max(func(curr->left), func(curr->right))On 4/3/06,
shooshweet <[EMAIL PROTECTED]> wrote:
Hi,Can anybody please suggest where I can find an algorithm thatrecursively calculates the length of the internal p
use locks then, both before reading the flag and writing the flag.On 4/3/06, Kevin <[EMAIL PROTECTED]
> wrote:oh, another way is have a flag in each node, true or false for visited
or not. But this may have problem is multi threads are using thisgraph, I think.
--~--~-~--~~
Hi,
Can anybody please suggest where I can find an algorithm that
recursively calculates the length of the internal path in a binary
tree?
Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks
oh, another way is have a flag in each node, true or false for visited
or not. But this may have problem is multi threads are using this
graph, I think.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Algorithm Gee
If we are going to do breadth first search in a graph, and this graph
has cycle, then how can we guarantee the search will end?
Actually, for any kind of graph traversal, how can we make sure we do
not loop forever at somewhere?
What I can think of is to put the node we have examed in a hash, an
very similar to TSP. A standard textbook problem :-)On 4/3/06, sarinarpit <[EMAIL PROTECTED]> wrote:
a directed Hamiltonian cycle DHC in a directed graph G+(V,E) is adirected cycle of length n=|V|,where |V| is the number of vertices in
G.So, the cycle goes through every vertex exactly once and the
a directed Hamiltonian cycle DHC in a directed graph G+(V,E) is a
directed cycle of length n=|V|,where |V| is the number of vertices in
G.So, the cycle goes through every vertex exactly once and then returns
to the starting vertex. The DHC problem is to determine if a given
directed graph G has a
You can do this using two stacks
---
Stack s, m;
Push(x):
s.push(x) if(x > m.top())
m.push(m.top())
else
m.push(x)
Pop():
m.pop()
return
Here is the improvement to my previous algorithm.
Observation 1.
ax+by can appear in the solution only if ax+bj has appeared in the solution where j > y.
Observation 2.
ax+bn can be included only if a(x+1)+bn is included in the answer.
1. Extract an+bn as the maximum
2. For
It doesn't matter. It's not correct. :((
Here's what the algo does: -
It was basically an attempted patch to the problem you indicated: -
curMin is the largest number which was not considered for printing at some stage - but might be useful at some
other stage...
Select an + bn
Next select ei
can u plz explain what is BFS + bitmask problem and how is it
applicable to my problem
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegr
Hi,
It is very hard for me to get the basic flow of this algorithm. Can you explain the basic idea behind the algorithm.
regards
Arunachalam.
On 4/3/06, Mayur <[EMAIL PROTECTED]> wrote:
right... that's correct. Arunachalam's right... Sorry... My second attempt at it... One assumption, thou
right... that's correct. Arunachalam's right... Sorry... My second attempt at it...
One assumption, though - the output need not be sorted...
1: curMin <- min( a[0], b[0] ) - 1
2: i <- n, j<-n
3: cnt <- 0, whoSurged = NONE;
4: while ( cnt < n )
{
5: output a[i] + b[j]
6: cnt <- cnt + 1
iwgmsft!!!
We can divide them into O(2logn) subproblems but it doesn't mean that
dividing them in these subproblems will take O(2logn) time. If we
process all n^2 elements it can never take less than O(n^2) time.
Arunachalam!
Your solution is correct (upto where i have looked into it).Good
wor
We can divide them into O(2logn) subproblems but it doesn't mean that
dividing them in these subproblems will take O(2logn) time. If we
process all n^2 elements it can never take less than O(n^2) time.
--~--~-~--~~~---~--~~
You received this message because you ar
Hi,
Can you give psedocode or demonstrate with an example.
Here goes my O(n log n) solution.
Observation 1.
ax+by can appear in the solution only if ax+bj has appeared in the solution where j > y.
1. Form a max heap of n elements with ai+bn where 1 <= i <= n.
2. Extract max (
20 matches
Mail list logo