this requires to store the nodes on the tranverse path, which will consume
more storage than constant
_
发件人: algogeeks@googlegroups.com [mailto:[EMAIL PROTECTED] 代表
Karthik Singaram Lakshmanan
发送时间: 2008年2月12日 4:40
收件人: algogeeks@googlegroups.com
主题: [algogeeks] Re: a non-recursive alg
Use a queue, assume the root of the binary tree : pRoot;
Below is the pseudo code:
enQueue(pRoot);
While( queue not empty )
{
pNode = outQueue();
print(pNode);
if(pNode->left)
{
enQueue(pNode->left);
}
if(pNode->right)
{
enQueue(pNode->right);
}
}
It’s possible.
Scan the digital picture pixel by pixel and line by line until you find the
first line with two black pixels ( the adjacent pixels is counted as only one
),name the two pixels a1(xa1,ya1) and b1(xb1,yb2), continue scaning and you
will get a2(xa2,ya2) and b2(xb2,yb2), a3(xa3,ya
perfect solution to implement the "if(amailto:[EMAIL PROTECTED]
发送时间: 2007年12月8日 22:47
收件人: [EMAIL PROTECTED]
抄送: [EMAIL PROTECTED]
主题: Re: greatest of two numbers
On Dec 8, 9:35 am, James Fang <[EMAIL PROTECTED]> wrote:
> Thanks for your correction...
>
> int get_max(int a,int b)
n the whole document?
Best Regards,
James Fang
-邮件原件-
发件人: algogeeks@googlegroups.com [mailto:[EMAIL PROTECTED] 代表
Shobhit Sinha
发送时间: 2007年12月5日 14:34
收件人: Algorithm Geeks
主题: [algogeeks] Re: Probability of a phrase in a text document?
Hi Abhishek,
Regarding your question
Could u post the problem ?
-邮件原件-
发件人: algogeeks@googlegroups.com [mailto:[EMAIL PROTECTED] 代表
doubt
发送时间: 2007年12月8日 11:40
收件人: Algorithm Geeks
主题: [algogeeks] Solution for problem 20-1
Does anybody have solution for problem 20-1 in cormen
--~--~-~--~~~---
No problem man.
I wonder what's the user senario of your probability.One document or
multiple documents are not the matter, because u can actually combine their
stastistics together.
Best Regards,
James Fang
-Original Mail-
发件人: algogeeks@googlegroups.com [mailto:[EMAIL PROT
ber/2)+1).
in situation 2), similar with situation 1), the only common divisor
(number/2-1) and (number/2+1) have is 2. Since we've already know that
number/2 is even, we can get the conclusion.
similar deduction on situation 3).
Regards and Thanks,
James Fang
On Dec 2, 7:35 pm, mali
Hi Abhishek,
You need to build up your metric for "probability" first.
For e.g.,
1. keywords occurrence/total words count
2. Keywords occurrence/total sentences
3. the number of files who contain keyword / total files number
Best Regards,
James Fang
-邮件原
On Nov 29, 12:23 am, "Anupama Murthi" <[EMAIL PROTECTED]>
wrote:
> Hi all,
> linear time to determine cyclic strings... give a linear time algorithm to
> determine if a text T is a cyclic rotation of another string T'. For eg. ARC
> and CAR are cyclic rotations of each other.
>
> --
> Anupama
my doubts to him. If this thread can come up with a solution like that
> then it is really good.
>
> Thanks and Regards,
> K.V.Chandra Kumar.
>
> On 26/11/2007, James Fang <[EMAIL PROTECTED]> w
ts.
then after the first scan, tranverse the Rows and Cols lists, clear
all the Rows and Cols in the list to zero.
Best Regards,
James Fang
On 11月27日, 上午12时50分, "James Fang" <[EMAIL PROTECTED]> wrote:
> The below algorit
The below algorithm cost 3*O(m*n)+NumberOfInitialZeros*( O(m)+o(n) )
=
No matter the array can hold other elements or not, you can
No matter the array can hold other elements or not, you can always use
auxiliary memory space to make it store more than 0&1, suppose it is a M*N
array,
initializing the auxiliary space will cost O(m*n).
and the algorithm can be described as follow:
for(int i=0; imailto:[EMAIL PROTECTED]
- array[i] + MAX_INT/2;
if(pair<0)
continue;
if( bitmap[pair] == marked )
found the answer!
else
mark bitmap[array[i]+ MAX_INT/2]
Best Regards,
James Fang
--
Sender: algogeeks@googlegroup
needs
to run.
Best Regards,
James Fang
-邮件原件-
发件人: algogeeks@googlegroups.com [mailto:[EMAIL PROTECTED] 代表
Sherry
发送时间: 2007年11月23日 4:26
收件人: Algorithm Geeks
主题: [algogeeks] How is the Big O actually calculated, time wise?
I know how the complexity of an algorithms is calculated
ocessor , the bitmap takes about 512MB of memory. However, if
this operation is in server side and is the bottle neck , the bitmap method
can be tried.
If the integer in the array have a stricted range, like [-x,y], the bitmap
method can be better applied.
Best Regards,
James Fang
-邮件原件
, with each bit
represents an integar number.
Best Regards,
James Fang
On 11月18日, 上午4时42分, geekko <[EMAIL PROTECTED]> wrote:
> Suppose that you have an array of integers. Given a number X are there
> any two numbers in the array in which their summation is equal to the
> X? Can you
18 matches
Mail list logo