It seems that the algorithms are O(Nk) where N is size of document and
k is number of keywords needed. So this means if you are looking for a
N/2 words in a document of length N, the worst case will actually be
O(N^2). Not something that you'll get from a google query, but still
possible for
I agree, this seems like freshman algo homework, ask TA for a hint.
The algorithm I described previously works fine. and it's probly in
one of the books anyways... U need something like a Potential
function, and do some monkeying around with it and it all works out.
On Feb 11, 10:04 pm, Sunny
, 5:12 pm, hc busy [EMAIL PROTECTED] wrote:
U, well, there is an 2^(1+lg(D))-1 time algorithm that uses
constant memory for a tree of size D. So, that's O(D).
Just do df-traversal for all levels of the tree outputting only the
nodes at current level.
On Jan 31, 2:18 am, dor [EMAIL
U, well, there is an 2^(1+lg(D))-1 time algorithm that uses
constant memory for a tree of size D. So, that's O(D).
Just do df-traversal for all levels of the tree outputting only the
nodes at current level.
On Jan 31, 2:18 am, dor [EMAIL PROTECTED] wrote:
O(n) extra memory will suffice,
U, well, there is an 2^(1+lg(D))-1 time algorithm that uses
constant memory for a tree of size D. So, that's O(D).
Just do df-traversal for all levels of the tree outputting only the
nodes at current level.
On Jan 31, 2:18 am, dor [EMAIL PROTECTED] wrote:
O(n) extra memory will suffice,
did u find this number ?
k bye
On Jan 26, 2008 3:32 AM, hc busy [EMAIL PROTECTED] wrote:
#2 is weird, start by observing that if you've seen n/2+2 items then
you're done.
You want n/2+1 equal numbers. So there needs to be a number that is
repeated once after seeing n/2+2 numbers
did u find this number ?
k bye
On Jan 26, 2008 3:32 AM, hc busy [EMAIL PROTECTED] wrote:
#2 is weird, start by observing that if you've seen n/2+2 items then
you're done.
You want n/2+1 equal numbers. So there needs to be a number that is
repeated once after seeing n/2+2 numbers
return max( 0/*zero*/, (max(R,L,R+L)+root.value), R, L, root.value);
On Jan 29, 1:40 am, Nima Aghdaie [EMAIL PROTECTED] wrote:
int maxw(node root)
{
if(root == null) return (0);
int L = maxw(root.lchild);
int R = maxw(root.rchild);
return max(
return max( 0/*zero*/, (max(R,L,R+L)+root.value), R, L, root.value);
On Jan 29, 1:40 am, Nima Aghdaie [EMAIL PROTECTED] wrote:
int maxw(node root)
{
if(root == null) return (0);
int L = maxw(root.lchild);
int R = maxw(root.rchild);
return max(
#2 is weird, start by observing that if you've seen n/2+2 items then
you're done.
You want n/2+1 equal numbers. So there needs to be a number that is
repeated once after seeing n/2+2 numbers for this to be possible(and
the rest must all be the same), now divide and conquer. For all
possible
If you take k balls out of a bunch of N balls, the probability of
having selected k balls is always one(1.0). It takes no calculation,
because after you sum that expression up, it add up to one by
definition/law of probability.
On Jan 23, 5:12 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
I
#2 is weird, start by observing that if you've seen n/2+2 items then
you're done.
You want n/2+1 equal numbers. So there needs to be a number that is
repeated once after seeing n/2+2 numbers for this to be possible(and
the rest must all be the same), now divide and conquer. For all
possible
Expectation Maximisation. I think the typical classroom example is
fitting k normal curves to data, and in that case, the best-fitting k
normal kurves will give the best Expectation. But the one thing that
people don't like about this is that it's not guaranteed to find all
of them.
They're
Now it's harder. For arbitrary image, you'll have to identify where
the circle is. But Jame's answer seems fine if the ONLY thing on the
picture is the circle and the two segments. just look for the left
most intersection and the right most intersection then follow the
line.
On Jan 4, 5:15 pm,
manner using
dynammic programming.
HTH,
Satish
On Jan 4, 1:45 am, hc busy [EMAIL PROTECTED] wrote:
At risk of stating the incredibly obvious, or giving away answer to a
fun interview question.
The naive but correct algorithm that gives the solution will have
tried every combination M
If you can scan pixels, why not just count # of pixels in the arc and
multiply by size of each pixel?
finding line intersection seems like a hard thing especially on a
scanned image like this one.
oh wait minute, it's an image... do you mean you want to find the
ratio of arc to circumference?
At risk of stating the incredibly obvious, or giving away answer to a
fun interview question.
The naive but correct algorithm that gives the solution will have
tried every combination M of K swimmers in M events. which will give
you K!/(K-M)! arrangements, and the algorithm would then compare
17 matches
Mail list logo