Algorithmic Toolbox week1 Stress Test More

?First, you notice that the stress test magically gave us the test in which our main solution and alternative solution differed very quickly. But that's not always the case.
?Often, the cases when there are equal numbers are some kinds of corner cases.
?So, when you want to do stress testing and you cannot find quickly a test on which your main solution and alternative solution differ, try to generate tests in a more focused subspace of full possible tests.For example,if you are working with graphs, try generating a disconnected graph,a full graph, a bipartite graph.

?Another important point is that if you found a test in which your solutions differ,don't hurry to debug something. First try to generate the smallest and easiest test on which your solutions differ. This will simplify your debugging a lot.

?Don't expect stress testing to be a silver bullet.
?For example, it probably won't find out that your main solution is too slow because your alternative solution will probably be even slower, some brute force solution.And you will have to generate only small random tests to compare them.
?In other cases, integer overflow. Even if you generate random tests with big numbers, both of your solutions could potentially have integer overflow problems. And then you will not notice that your main solution has them in the stress test.

So first, test for some manual cases, and then apply stress testing.

?However, if you've done manual tests, integer overflow testing, and max test, and then apply stress testing, you're almost guaranteed to have success with it.

?Because the authors of the problem do basically the same when they make the test sets for you.
?They make some manual tests, they make tests with big numbers for integer flow, they make big tests for checking time limit, and then they generate some random tests and maybe some focused random tests.

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末楷拳,一起剝皮案震驚了整個(gè)濱河市地淀,隨后出現(xiàn)的幾起案子互亮,更是在濱河造成了極大的恐慌,老刑警劉巖这敬,帶你破解...
    沈念sama閱讀 218,640評(píng)論 6 507
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件搜锰,死亡現(xiàn)場(chǎng)離奇詭異,居然都是意外死亡,警方通過查閱死者的電腦和手機(jī)域携,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,254評(píng)論 3 395
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來鱼喉,“玉大人秀鞭,你說我怎么就攤上這事】盖荩” “怎么了锋边?”我有些...
    開封第一講書人閱讀 165,011評(píng)論 0 355
  • 文/不壞的土叔 我叫張陵,是天一觀的道長(zhǎng)编曼。 經(jīng)常有香客問我豆巨,道長(zhǎng),這世上最難降的妖魔是什么掐场? 我笑而不...
    開封第一講書人閱讀 58,755評(píng)論 1 294
  • 正文 為了忘掉前任往扔,我火速辦了婚禮,結(jié)果婚禮上熊户,老公的妹妹穿的比我還像新娘萍膛。我一直安慰自己,他們只是感情好嚷堡,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,774評(píng)論 6 392
  • 文/花漫 我一把揭開白布蝗罗。 她就那樣靜靜地躺著,像睡著了一般蝌戒。 火紅的嫁衣襯著肌膚如雪串塑。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 51,610評(píng)論 1 305
  • 那天瓶颠,我揣著相機(jī)與錄音拟赊,去河邊找鬼。 笑死粹淋,一個(gè)胖子當(dāng)著我的面吹牛吸祟,可吹牛的內(nèi)容都是我干的瑟慈。 我是一名探鬼主播,決...
    沈念sama閱讀 40,352評(píng)論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼屋匕,長(zhǎng)吁一口氣:“原來是場(chǎng)噩夢(mèng)啊……” “哼葛碧!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起过吻,我...
    開封第一講書人閱讀 39,257評(píng)論 0 276
  • 序言:老撾萬榮一對(duì)情侶失蹤进泼,失蹤者是張志新(化名)和其女友劉穎,沒想到半個(gè)月后纤虽,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體乳绕,經(jīng)...
    沈念sama閱讀 45,717評(píng)論 1 315
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,894評(píng)論 3 336
  • 正文 我和宋清朗相戀三年逼纸,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了洋措。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 40,021評(píng)論 1 350
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡杰刽,死狀恐怖菠发,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情贺嫂,我是刑警寧澤滓鸠,帶...
    沈念sama閱讀 35,735評(píng)論 5 346
  • 正文 年R本政府宣布,位于F島的核電站第喳,受9級(jí)特大地震影響糜俗,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜墩弯,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,354評(píng)論 3 330
  • 文/蒙蒙 一吩跋、第九天 我趴在偏房一處隱蔽的房頂上張望寞射。 院中可真熱鬧渔工,春花似錦、人聲如沸桥温。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,936評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽侵浸。三九已至旺韭,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間掏觉,已是汗流浹背区端。 一陣腳步聲響...
    開封第一講書人閱讀 33,054評(píng)論 1 270
  • 我被黑心中介騙來泰國(guó)打工, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留澳腹,地道東北人织盼。 一個(gè)月前我還...
    沈念sama閱讀 48,224評(píng)論 3 371
  • 正文 我出身青樓杨何,卻偏偏與公主長(zhǎng)得像,于是被迫代替她去往敵國(guó)和親沥邻。 傳聞我的和親對(duì)象是個(gè)殘疾皇子危虱,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,974評(píng)論 2 355

推薦閱讀更多精彩內(nèi)容