[algogeeks] Re: finding whether the number is prime or not ...

2008-06-19 Thread Yingjie Xu
You may search at google for the paper Prime is in P for a P algorithm. Note this algorithm is not that fast when given n is small. On Thu, Jun 19, 2008 at 1:55 PM, zee [EMAIL PROTECTED] wrote: hi everyone ... any efficient algo to find a number is prime or not ??? (i agree the question

[algogeeks] Re: I Like Sudoku

2008-04-09 Thread Yingjie Xu
Till now, nobody successfully generate this puzzle. On Wed, Apr 9, 2008 at 8:59 PM, adak [EMAIL PROTECTED] wrote: I'm also very curious about Sudoku. Particularly the search for a grid with a unique answer, from only 16 given values. First problem is how to generate EVERY Sudoku grid which

[algogeeks] Re: Finding the subtree with the largest weight

2008-01-29 Thread Yingjie Xu
A rooted tree or a general tree? On Jan 29, 2008 3:07 PM, Debajit Adhikary [EMAIL PROTECTED] wrote: Lets say I have a weighted tree (with positive, zero and negative weights for each node). How could I best find the subtree having the maximum weight?

[algogeeks] Re: Finding the n integers given the set of sums.

2007-11-07 Thread Yingjie Xu
sort the sums, call them s1, s2, s3,..., satisfy s1 = s2 = s3 = and set the n integers by a1, a2, a3, satisfy a1 = a2 = a3 = so we can sure that s1 = a1 + a2, and s2 = a1 + a3, and what is a2 + a3? only a1 + a4, a1 + a5, ..., a1 + an can less than a2 + a3, so a2 + a3 is one of s3, s4, ...

[algogeeks] Re: min height rootless tree

2007-10-29 Thread Yingjie Xu
Calculate center of a tree, can be solved in O(n). On 10/25/07, dkrai [EMAIL PROTECTED] wrote: Another approach can be to eliminate leaf nodes iteratively from tree. At last only root node or nodes on same level will be left. Adjency list representation of graph will make it easier to

[algogeeks] Re: Delete element in a sorted array with O(1) time complexity.

2007-08-17 Thread Yingjie Xu
Generally, it's impossible... -- Forwarded message -- From: 刘昊 [EMAIL PROTECTED] Date: Aug 17, 2007 7:58 PM Subject: [algogeeks] Delete element in a sorted array with O(1) time complexity. To: Algorithm Geeks algogeeks@googlegroups.com Hi, folks, As the title of the post

[algogeeks] Re: Implementation of Dijkstra and other shortest path problems.

2007-07-21 Thread Yingjie Xu
Implements yourself please. On 7/21/07, TheTravellingSalesman [EMAIL PROTECTED] wrote: I'm using Java programming language and I'm trying to implement the shortest path algorithm. One thing I'm struggling with is how do I represent nodes and edges in Java. Don't know of too many Java

[algogeeks] Re: IAUM - CCC4 Programming Contest (Persian)

2007-07-18 Thread Yingjie Xu
What's Mordad and Shahrivar? Is it an English word? On 7/19/07, Mohammad [EMAIL PROTECTED] wrote: قابل توجه علاقمندان به مسابقات برنامه نویسی، چهارمين دوره از مسابقات برنامه نویسی IAUMCCC ، تابستان امسال در دانشگاه آزاد اسلامی برگزار خواهد شد. این سری از مسابقات سه مرحله ای می باشد. مرحله

[algogeeks] Re: graph theory

2007-06-21 Thread Yingjie Xu
No, longest path isn't that easy. We can find the Halminton path as well as the longest path, but... On 6/20/07, Muntasir Khan [EMAIL PROTECTED] wrote: On 6/20/07, mirchi [EMAIL PROTECTED] wrote: can anyone please tell me how to find single source longest path in a directed acyclic

[algogeeks] Re: acm problem : i need help

2007-05-16 Thread Yingjie Xu
a c style string with length n needs n+1 memory space. On 5/16/07, mirchi [EMAIL PROTECTED] wrote: hello people , i am facing a problem in submission of The Hamming Disteance problem. the output seems to be fine. but the program crashes in between. the error says: The instruction at