[algogeeks] Re: Can anyone point out the mistakes in my program?

2006-06-26 Thread Thomas.Chang
he "i++" "j--" expressions are just to skip the sticks[left] and find the right position for it, so I don't think that's a weak point. Also, all cases have passed under my program. Everything proves ok logically and practically. That's what is anonying me. adak wr

[algogeeks] Re: Can anyone point out the mistakes in my program?

2006-06-25 Thread Thomas.Chang
Thanks, but it seems not a problem. if(ihttp://groups.google.com/group/algogeeks -~--~~~~--~~--~--~---

[algogeeks] Can anyone point out the mistakes in my program?

2006-06-25 Thread Thomas.Chang
Following is a qsort() program, I checked it carefully severally times and tested with a lot of cases without finding any error. But when I submit the program using it to online judge, it always "wrong answer", if I substitute it with the standard qsort() of c library, it will pass. I post it here

[algogeeks] Re: a problem

2006-06-17 Thread Thomas.Chang
I find that the common solution is to find the LIS (longest incremental sequence) repeatedly. Generally it's a little complex. My solution is as follows: maintain a group array, in which each element is the last one in that group(sequence); for a new one, we just find the largest group element wh

[algogeeks] Re: a problem

2006-06-17 Thread Thomas.Chang
Greedy algorithm can only get the optimal solution, can it give a correct one? the optimal solution is not the best fit. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group

[algogeeks] a problem

2006-06-16 Thread Thomas.Chang
suppose a number sequence, for example: 4, 1, 5, 9, 2, 3 the task is to devide it into as less groups as possible so that in each group the numbers are sorted incrementally without changing the original order. for example, the above sequence can be devided into: 4, 5, 9, 1, 2, 3 2 groups in all.

[algogeeks] pre_order & post_order traversal of a threaded binary tree

2006-05-20 Thread Thomas.Chang
sm1664809pyd.2006.05.19.20.38.08; Fri, 19 May 2006 20:38:09 -0700 (PDT) Message-ID: <[EMAIL PROTECTED]> Date: Sat, 20 May 2006 11:42:16 +0800 From: "Thomas.Chang" <[EMAIL PROTECTED]> User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050927 Debian/1.7.8-1sarge3 X-Acc

[algogeeks] Re: Writing C program without main()

2006-05-15 Thread Thomas.Chang
The main() is just an entry to a program, telling the computer to execute right here. So if you can tell the CPU in other ways, you can abandon main(). That's why when computer starts, POST will be triggered, CPU just fetch the first instruction from bios and execute. deepblue wrote: >Hi Arul

[algogeeks] improving iter_postorder traversal for binary tree

2006-05-14 Thread Thomas.Chang
if(!ptr) return; printf("%d", ptr); } } } } Thomas.Chang --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post