[algogeeks] Re: Binary Tree Depth()

2007-03-06 Thread NUPUL



On Feb 28, 8:06 pm, k3xji [EMAIL PROTECTED] wrote:

 Is there any way of calculating the depth of a binary tree without
 using *recursive way*.Also not using *log2-1* method.I am asking this
 because Is there any way of doing this kind of operation with just
 using stacks or quenes.

Yes. You can simulate recursion by explicitly creating your own
stack and storing the pointers to the traversed nodes OR Create a
threaded (inorder) binary tree, this too eliminates the need of
recursion when traversing the tree in order.

This solution is offered in a standard book on data structures by
Tanenbaum.

In other words, is there a some kind of
 compiler optimization just to avoid recursive call overhead?

Not an optimization per se but the above avoids the recursion overhead

Here is
 the recursive one (pseudo): Any comments?(Also optimization is not
 important here.Is it just possible to implement an algorithm using one
 stack or one quene,like traversal methods do?)

Which other traversal methods are you talking about? The 'graph'
traversal methods are usually specified recursively as they are easier
to read/understand that way.

Regards,

Nupul


--~--~-~--~~~---~--~~
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]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~--~~~~--~~--~--~---



[algogeeks] Re: Generalized Shortest Path Problem

2007-03-06 Thread NUPUL



On Feb 27, 1:04 am, Ez_Alg [EMAIL PROTECTED] wrote:

snip

 here is my question:
 In Internet routing, there are delays on lines but also, more
 significantly, delays at routers.
 Suppose that in addition to having edge lengths l(e) : e in E, a graph
 also has vertex costs

It seems you've got the algorithm from data structures by tanenbaum,
where the algorithm is taking only the edge costs into account. Try
this book Introduction to algorithms:  Cormen you can tweak the
algorithm given there to suit your needs.

Regards,

Nupul


--~--~-~--~~~---~--~~
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]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~--~~~~--~~--~--~---



[algogeeks] Interesting Probability Question

2007-03-06 Thread Rajiv Mathews

I came across this interesting probability question recently.

Consider an infinite two dimensional plane. 4 points are chosen at
random on this plane. What is the probability that the convex hull of
the 4 points will be a quadrilateral?

-- 


Regards,
Rajiv Mathews

--~--~-~--~~~---~--~~
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]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~--~~~~--~~--~--~---



[algogeeks] http://www.javaref.cn Java参考中文站加入了批量的面试题217篇,大概5 千多道题。。汗啊

2007-03-06 Thread daben daben
http://www.javaref.cnJava参考中文站加入了批量的面试题217篇,大概5千多道题。。汗啊。又有的看了

首页 http://www.javaref.cn
面试题 http://www.javaref.cn/topics/Question/index7.html



___ 
抢注雅虎免费邮箱-3.5G容量,20M附件! 
http://cn.mail.yahoo.com
--~--~-~--~~~---~--~~
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]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~--~~~~--~~--~--~---