absmiddle Girl Friend Algorithm & Analysis

[版主] 本文轉自清大電機 Test 版 ax (假面.喵∼): if (you desired to have a gf && you are normal male human) { if (look for female human == SUCCESS) { if (talk to target == SUCCESS) { if(catch target == SUCCESS) goto SUCCESS; else { fall in depression; examine what's wrong; goto initial condition; } } else { examine what's wrong; goto initial condition; } } else { go to hell; } } else if (you are currently hunted by a girl && you are male human) { if (the girl does not match your requirement) { get rid off her; goto initial condition as soon as possible; } else { catch the girl; goto SUCCESS; } } else go to take a look of psychologist; Analysis: This is an NP-Complete algorithm, since the procedure "examine what's wrong" is NP-Complete. NP-Complete here has a special meaning: No-Person (can) complete. However, there exists a best case which is O(1) and the constant value is rarely big. Just like me :) Copyleft 1995, Jen-Jia Hsu