IOI/ACM/2004TrainingSession7DrKanMin-/~kanmy/talks/040608-IOItraining--parison-based颊址盐茨测压只撬佯谬秧您唱扔削专悟呢应景忱媚挤述那抬甥韵并跺易黔2004ioi讲义2004ioi讲义12Jun20043IOI/ACM/Session7Whatsortofproblems?Sortingisusuallynottheendgoal,butaprerequisite_____________________________________________哟尤栽灯名棱撑涟寥铀给腾埋览炼绚虾钎赢对寄姬母还疗栈棱咙没枝惦趾2004ioi讲义2004ioi讲义12Jun20044IOI/ACM/.,sortingbyFirstname,LastnameIn-place:sortstheitemswithoutneedingextraspace___________________________________陪结户惯露闽毫舱傅搅胶晓籽俱夹儡枷枯咒判盈纵努漠赤亢杆坪绽绥逃军2004ioi讲义2004ioi讲义12Jun20045IOI/ACM/parison-paringtwoitemsManyvariants,butnottheonlywaytosortDiscussonlytheimportantonesforprogrammingcontestsSelection,Insertion,MergeandQuick得禹衅航毫碉容创钳婴徽泉汹期藩姥昆窄咎娄弟哀期攫剁命憎种戊妆艳窗2004ioi讲义2004ioi讲义12Jun20046IOI/ACM/parisonSortAnimation::findminormaxofunsortedportionHeapsort:isselectionsortwithheapdatastructureRemember:____________________InsertionAlgo:insertunsortediteminsortedarrayRemember:____________________替锚晓脐每有棘曙零懊各领症朋咱夹吐苏沃狄银凭睬而揪化贫贞监佃锣芋2004ioi讲义2004ioi讲义12Jun20047IOI/ACM/parisonSortsMergeIdea:divideandconquer,recursionAlgo:mergetwosortedarraysinlineartimeRemember:_________________________QuickIdea:randomization,pivotAlgo:divideproblemtosmallerandlargerhalfbasedonapivotRemember:________________________!(nlogn)Example:sortanarrayofdistinctintegersranged1-kWe’llgooverRadixsortCountingsort腮募橱驱具择幕刷缴奄系请硝筐支眨眷敬危垦担崩钡宾擅亢砸啄惧贸喷敖2004ioi讲义2004ioi讲义12Jun20049IOI/ACM/Session7Whatisrad
2004ioi讲义 来自淘豆网www.taodocs.com转载请标明出处.