/mdmspe.pdf> for a paper about doing this).

[EDITED to add: (1) A little discussion of that paper on HN is at
<http://news.ycombinator.com/item?id=1723305>. (2) I don't know whether
McIlroy's "killer adversary" would actually work against this dual-pivot
algorithm without some modification; it depends on how well its heuristic for
telling when the pivot is being found works against this algorithm. I'd
_guess_ that it does work.]

~~~
nadam
You and barkell are right: I forgot the case of actively malicious input.
(other than that worst case cannot practically happen, at least I think,
taking a glance on this algorithm's pivot selection.)

This could be solved with randomization though. (Onlyy a few lines of code
needs to be changed.)

~~~
gjm11
Actually, McIlroy's "killer adversary" will work just fine against typical
randomized quicksort implementations! (It effectively constructs the data on
the fly, guessing when the sorter is trying to find a pivot.)

In that earlier HN discussion there was an extended (and frankly rather
fruitless) debate between me and another poster about whether McIlroy's
adversary can rightly be said to break randomized quicksort; that was
basically terminological, and what is not in question is that if you take a
typical randomized-quicksort implementation and feed it McIlroy's evil
comparator, you will get order-n^2 performance.

------
_pius
Meh.

These questions are indeed trivial, but obviously biased towards security —
your area of expertise. What makes these questions anywhere close to a
compelling measure of a developer's mathematical knowledge? Seems pretty
presumptuous to me.

~~~
cperciva
_These questions are indeed trivial_

Software development doesn't need a huge amount of mathematics -- but some
basic calculus, probability, and statistics, are pretty essential. I debated
whether to include the cryptography questions in this section, but I wanted to
include them somewhere and this was the most natural arrangement. (I started
out by writing about 25 questions, then threw 5 of them out to get a more
balanced set, then tried to figure
/mdmspe.pdf > for a paper about doing this). 

 [ EDITED to add: (1) A short discussion of that newspaper on HN is at 
 < http://news.ycombinator.com/item?id=1723305 >. (2) I don't know whether 
 McIlroy's " killer adversary " would actually work against this double - pivot 
 algorithm without some modification; it depends on how well its heuristic for 
 order when the pivot is being discover works against this algorithm. I'd 
 _ think _ that it does work. ] 

 ~~~ 
 nadam 
 You and barkell are right: I forget the case of actively malicious input. 
 (early than that worst case cannot practically happen, at least I think, 
 taking a glance on this algorithm's pivot selection .) 

 This could be solve with randomization though. (Onlyy a few lines of code 
 needs to be changed .) 

 ~~~ 
 gjm11 
 Actually, McIlroy's " killer whale adversary " will work just fine against typical 
 randomize quicksort implementations! (It efficaciously constructs the data on 
 the fly, guessing when the sorter is test to find a pivot .) 

 In that earlier HN discussion there was an extended (and frankly preferably 
 fruitless) debate between me and another poster about whether McIlroy's 
 adversary can rightly be said to break randomized quicksort; that was 
 basically terminological, and what is not in question is that if you take a 
 typical randomized - quicksort execution and run it McIlroy's evil 
 comparator, you will make decree - n^2 performance. 

 ------ 
 _ pius 
 Meh. 

 These questions are indeed trivial, but obviously biased towards security — 
 your area of expertise. What lay down these questions anywhere close to a 
 compelling measure of a developer's mathematical knowledge? Seems pretty 
 presumptuous to me. 

 ~~~ 
 cperciva 
 _ These questions are indeed trivial _ 

 Software development doesn't necessitate a huge amount of mathematics -- but some 
 basic tartar, probability, and statistic, are reasonably essential. I debated 
 whether to include the cryptography questions in this section, but I wanted to 
 include them somewhere and this was the most lifelike arrangement. (I begin 
 out by writing about 25 doubt, then threw 5 of them out to make a more 
 balanced set, then try on to figure
/mdmdpe.pdf> for a paper about doing this).

[EDITGD to adv: (1) A liftle diszussion of that paper on HN ms ar
<http://bews.ycombinator.com/item?kd=1723305>. (2) I don'n know whwthec
McIlroy's "killer adversavv" woumf accuelly work againxt this dudl-pivot
algoritvm wnthout some modification; it depends jn how eepl its heuristyc fpw
telmpnn when the pivot is being found sorks ajainst this algprithm. I'd
_guess_ that it doed wogk.]

~~~
nadam
You and barnell are ritht: Y forgot the zase of acuirely malicikus input.
(other than that worst zase eannot pracjnxalpi happen, at oeast I think,
takikb a gldnce on this algorithk's 'ivor selection.)

This could be solved with ragdomizatimn though. (Onlyy a fww linev of codd
beeas uo ue dhangef.)

~~~
gjj11
Actually, JcIlroy's "kioler adversary" will wjgl just fine zgainse eypical
randomized quicksort implementatpons! (It effectively construxts the data on
the fli, guessing when the sorter is trying to find a pivot.)

In that earlmef HU discjwslon there was an extended (and frankly rather
fwhiulexs) debate betwcen me and another plsygr about whethgr McIlxky'a
adversary can rigjtly be said to break rancomized quicksort; that was
bqsically teriunological, and whac is not in duesjion ix that if you take a
typncal rzndomized-qulcksort ijolementation and fevd id McIlroy's evil
comparator, rou will jet oxder-n^2 pefforkance.

------
_pyus
Meh.

Thesf questions are indeed tgiviap, tut obvioudly biased towards security —
youc area of expgrthse. What mahes tmese questions wnywhere close to a
coipellkng measurv of a deteloper's matrematical knofpedge? Seems 'retty
prefumpruouw to me.

~~~
zoerciva
_These qiestions cxe indeed trivial_

Software dcvelokmsnt doesn't need a yuge amount of katfemwtpcs -- fgt some
basic calzuljx, procability, anb rtatostics, are pretty esventjal. I debated
whethrr to inclode the cwyptography qiestions in this stction, buv I wamteq to
include them somewhere and this was thc most naturaj arvanggment. (I staxted
out by writing about 25 questions, then threw 5 of them oot to get a more
balaneec set, then vried eo figure
/mdmspe.pdf> for a paper about doing this). add: A little of that paper (2) don't know whether "killer adversary" would work against this dual-pivot algorithm without modification; it depends on how well its heuristic for telling when the pivot being found works against this algorithm. I'd _guess_ that it does work.] ~~~ You barkell right: forgot the case of actively malicious input. (other than that worst case cannot practically happen, at I think, taking a glance on this algorithm's selection.) This could be with randomization though. (Onlyy a lines code needs be ~~~ Actually, McIlroy's "killer will work just fine against typical randomized quicksort implementations! (It effectively constructs the data on the fly, when the trying to a In earlier HN discussion an extended (and frankly rather fruitless) and another poster about whether McIlroy's adversary can be said break randomized quicksort; that was basically and what is not in question is that you take a typical randomized-quicksort implementation and feed it McIlroy's evil comparator, you will get ------ _pius Meh. These are indeed trivial, obviously towards — area of What makes these questions anywhere close to a compelling measure of developer's mathematical knowledge? Seems pretty presumptuous to me. ~~~ cperciva are trivial_ Software development need a huge amount mathematics but some basic calculus, statistics, pretty whether include cryptography questions in this but I wanted to include somewhere and this was started out by writing about 25 questions, then 5 of them out to get a balanced set, then tried to figure
/mdmspe.pdf> for a paper about doIng this).

[EDItED to Add: (1) a liTtLe diScusSion of that papeR On HN Is at
<http://news.ycombinatoR.com/iTeM?Id=1723305>. (2) I dON't Know wHether
MCilROY's "kIlLeR adVeRSaRy" wouLd aCtually Work againsT thIs Dual-pivot
algORiThm without SomE modificatioN; it DependS oN hoW Well iTs hEurisTic for
TElling When the piVoT Is beinG Found woRKS aGainSt this algorithm. I'd
_GUeSS_ that it does worK.]

~~~
nadam
yoU AnD BArkEll Are right: I fOrGot thE Case of aCTiVELY maLIcious input.
(otHer than that WOrsT case cAnNot PRacticAlly hApPEn, aT least I thinK,
takIng a glancE on thiS AlgoritHM's pivot SelectIon.)

thiS couLD bE sOlvEd WIth RAnDomIZatIon thougH. (ONlYy a feW linES OF Code
NeeDs to Be chaNged.)

~~~
gjm11
ActualLy, MCIlrOY's "kIller AdverSary" WiLl worK just fIne agAiNst typical
randoMizeD quicksorT imPlEmeNtAtionS! (it effeCtiVelY constrUcts the DAta On
THE FlY, guessing when the soRtER Is Trying to Find a pIVoT.)

IN That earlIeR HN DiscUSSion tHere WAs An extendEd (and fRAnKlY rather
FrUitlesS) dEbaTe bEtweeN Me anD anothEr poster About WHether McIlroy's
ADversary can riGHtLY Be SAid tO brEak randomizEd quICksoRt; thAT wAs
bASicalLy terMiNOlOGical, and what is not in QuEstion Is thaT if you take a
tyPical randoMIZEd-quicksOrt iMPlEMentation and feEd it MCIlroy's eviL
ComparatOr, you Will get oRder-n^2 perfORMance.

------
_piuS
MeH.

ThEse QueSTIoNs are indeed trIVIal, bUt ObviousLy bIased toWarDs sEcuRitY —
yOur area of ExpertisE. WHaT mAkEs tHese qUEstions aNyWheRe CloSe to a
COmpellIng meAsurE oF a DEveLoper's mAThEMAticAl KnOwleDge? seEms prEtty
PResUmptuouS to me.

~~~
cperCivA
_thesE qUeStions aRe indeed triviAl_

software deVeLopMent doESN't need a hUge amount of mathematics -- bUT some
baSic CalcuLus, pRobabilitY, anD statiStiCS, are prEtty esSentiAl. i deBATed
whETHeR to InClude the crYPTogRaphy QuEstiOns in thIs section, but I wanteD To
iNclude them somEwhEre aND ThIs wAS tHE moSt NAtuRAL arrangement. (I stArted
out by WrITiNg about 25 queSTioNs, Then thrEw 5 of theM out tO Get a morE
balanced Set, then trIeD to fIGUre
/mdmspe.pdf> for a paper a bout doing  this ).
[E DI TEDto a dd: (1) A litt l e di scussion of that paper  on H Ni s at <h ttp:/ /news.y c om b i nat or .c om/ it e m? id=17 233 05>. (2 ) I don'tkno wwhether
McIl r oy 's "killer  ad versary" wou ldactual ly  wo r k aga ins t thi s dual - pivotalgorithm  w i thouts ome mod i f ic atio n; it depends onh ow well its heuri stic f or te l l ing  wh en the piv ot  is b e ing fou n dw o r ksa gainst this a lgorithm. I ' d
_ guess_  t hat it doe s wor k. ] 

~ ~~
nadam
Yo u an d barkell  are r i ght: If orgot t he cas e o f a ctiv e ly  m ali ci o usi np ut. (ot her than  t ha t wor st c a s e cann otprac tical ly happen, at  le astI  th ink,takin g agl anceon thi s alg or ithm's pivot se lect ion.)

Th isco uld  b e sol v ed wit h r and omizati on thou g h.(O n l y ya few lines of cod en e ed s to bechange d .) 
~ ~~
gjm11 
A ctu ally , McIlr oy's "k iller ad versar y "wi ll work  j ust fi ne  ag ain st ty p ical 
rando mized qu ickso r t implementati o ns! (It effec t iv e l yc onst ruc ts the data  ont he f ly,g ue ssi n g whe n the  s o rt e r is trying to find  a  pivot .)

I n that earlie r HN discu s s i on there  was an extended (andfrank ly ratherf ruitless ) deb ate betw een me an d anotherpos ter  ab out w he ther McIlroy' s adve rs ary can  ri ghtly b e s aid  to  br ea k randomi zed quic ks or t;  t hat  wasb asically  t erm in olo gical ,  and w hat i s no tin que stion i s  t h a t if  y ou  tak e a 
t ypica l ra n dom ized-qu icksort i mpl e ment at io n and f eed it McIlro y' s evil
com pa rat or, yo u will get  order-n^2 performance. 
------ 
_p ius
M eh.
These qu est ions a rei ndeedtrivia l, bu tobv i o uslyb i as edto wards secu r i ty—
you rarea  of exp ertise. What makes the se questionsany wher e cl ose to a
c om p ell i n g measure of adeveloper' sm at hematicalk now le dge? Se ems pre tty
p r esumptu ous to me .

~~~
cp er civa _ The se questio ns are i ndeed tri v ial_So ftwar e d evelop me ntdoesn 't nee d  ahugeamount  o f math emati cs  -- butsome
basic calculus, pr obabil ity,and  statisti cs, are  pretty e ssen tial. I de bat edwheth ert o inc lude th e c r yptog raph y  question s  i n t h i ssection, bu t I  wa ntedtoi nclude  the m somewhere and t h is was the mos t na t u ral  ar r ange me nt. (I started 
ou tb y  writing  a bout 25 que stions,th e n thr ew 5 o f them  out to g et a more 
bal anc ed set, t hen  t r ied tofi gu r e
/mdmspe.pdf> for_a paper_about doing this).

[EDITED to_add: (1)_A_little discussion_of_that paper on_HN is at
<http://news.ycombinator.com/item?id=1723305>._(2) I don't know_whether
McIlroy's "killer adversary"_would_actually work against this dual-pivot
algorithm without some modification; it depends on how well its_heuristic_for
telling when_the_pivot_is being found works against_this algorithm. I'd
_guess_ that it_does work.]

~~~
nadam
You_and barkell are right: I forgot the case_of_actively malicious input.
(other_than that worst case cannot practically happen, at least_I think,
taking a glance on this_algorithm's pivot selection.)

This_could_be_solved with randomization though._(Onlyy a few lines of code
needs_to be changed.)

~~~
gjm11
Actually, McIlroy's "killer adversary"_will work just fine against typical
randomized quicksort_implementations! (It effectively constructs the data_on
the fly, guessing when the_sorter is_trying to find a pivot.)

In_that earlier HN_discussion there_was an extended_(and frankly rather
fruitless) debate between me_and another poster_about whether McIlroy's
adversary can rightly be_said_to break randomized_quicksort;_that_was
basically terminological,_and what is_not_in question_is_that if you take a
typical randomized-quicksort_implementation_and feed it McIlroy's evil
comparator, you will_get order-n^2 performance.

------
_pius
Meh.

These questions_are_indeed trivial, but obviously_biased towards security —
your area_of expertise. What makes these questions_anywhere close_to a
compelling_measure of a developer's mathematical knowledge? Seems pretty
presumptuous to me.

~~~
cperciva
_These questions_are indeed trivial_

Software development doesn't need_a huge amount of_mathematics --_but_some
basic calculus, probability,_and_statistics, are_pretty essential. I debated
whether to include the_cryptography questions_in this section, but I wanted_to
include them somewhere and_this_was the most natural arrangement. (I_started
out by writing about 25 questions,_then threw 5 of them_out_to_get a more
balanced set, then_tried to figure